From b8082caa8eb5c16020f805ff70ef61454e07175c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 11 Nov 2016 15:58:52 -0800 Subject: [PATCH 01/41] Clean up jsdoc in utilities Fix functions that were unused (getJsDocComments), redundant (append) or badly named (getJSDocCommentsFromText) --- src/compiler/declarationEmitter.ts | 2 +- src/compiler/parser.ts | 2 +- src/compiler/utilities.ts | 46 +++++++++--------------------- 3 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 0bba375a2cb..3b48f453478 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -371,7 +371,7 @@ namespace ts { function writeJsDocComments(declaration: Node) { if (declaration) { - const jsDocComments = getJsDocCommentsFromText(declaration, currentText); + const jsDocComments = getJSDocCommentRanges(declaration, currentText); emitNewLineBeforeLeadingComments(currentLineMap, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space emitComments(currentText, currentLineMap, writer, jsDocComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, writeCommentRange); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 943a677ef5d..682c22b4fba 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -676,7 +676,7 @@ namespace ts { function addJSDocComment(node: T): T { - const comments = getJsDocCommentsFromText(node, sourceFile.text); + const comments = getJSDocCommentRanges(node, sourceFile.text); if (comments) { for (const comment of comments) { const jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a9f2429d376..9aa0e4267cf 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -638,25 +638,18 @@ namespace ts { return getLeadingCommentRanges(text, node.pos); } - export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) { - return getJsDocCommentsFromText(node, sourceFileOfNode.text); - } - - export function getJsDocCommentsFromText(node: Node, text: string) { + export function getJSDocCommentRanges(node: Node, text: string) { const commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter || node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction) ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); - return filter(commentRanges, isJsDocComment); - - function isJsDocComment(comment: CommentRange) { - // True if the comment starts with '/**' but not if it is '/**/' - return text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && - text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk && - text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash; - } + // True if the comment starts with '/**' but not if it is '/**/' + return filter(commentRanges, comment => + text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk && + text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk && + text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash); } export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; @@ -1453,18 +1446,6 @@ namespace ts { } } - function append(previous: T[] | undefined, additional: T[] | undefined): T[] | undefined { - if (additional) { - if (!previous) { - previous = []; - } - for (const x of additional) { - previous.push(x); - } - } - return previous; - } - export function getJSDocComments(node: Node, checkParentVariableStatement: boolean): string[] { return getJSDocs(node, checkParentVariableStatement, docs => map(docs, doc => doc.comment), tags => map(tags, tag => tag.comment)); } @@ -1482,7 +1463,6 @@ namespace ts { } function getJSDocs(node: Node, checkParentVariableStatement: boolean, getDocs: (docs: JSDoc[]) => T[], getTags: (tags: JSDocTag[]) => T[]): T[] { - // 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... let result: T[] = undefined; // prepend documentation from parent sources @@ -1505,11 +1485,11 @@ namespace ts { isVariableOfVariableDeclarationStatement ? node.parent.parent : undefined; if (variableStatementNode) { - result = append(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); } if (node.kind === SyntaxKind.ModuleDeclaration && node.parent && node.parent.kind === SyntaxKind.ModuleDeclaration) { - result = append(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); } // Also recognize when the node is the RHS of an assignment expression @@ -1520,30 +1500,30 @@ namespace ts { (parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken && parent.parent.kind === SyntaxKind.ExpressionStatement; if (isSourceOfAssignmentExpressionStatement) { - result = append(result, getJSDocs(parent.parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(parent.parent, checkParentVariableStatement, getDocs, getTags)); } const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment; if (isPropertyAssignmentExpression) { - result = append(result, getJSDocs(parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(parent, checkParentVariableStatement, getDocs, getTags)); } // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { const paramTags = getJSDocParameterTag(node as ParameterDeclaration, checkParentVariableStatement); if (paramTags) { - result = append(result, getTags(paramTags)); + result = concatenate(result, getTags(paramTags)); } } } if (isVariableLike(node) && node.initializer) { - result = append(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags)); + result = concatenate(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags)); } if (node.jsDocComments) { if (result) { - result = append(result, getDocs(node.jsDocComments)); + result = concatenate(result, getDocs(node.jsDocComments)); } else { return getDocs(node.jsDocComments); From ad9ad8f948bf2cb7c03fc152e81cb8c911990a8d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 17 Nov 2016 11:08:11 -0800 Subject: [PATCH 02/41] Clean up getJSDocTypeForVariableLikeDeclarationFromJSDocComment Yeah, that name is way too long. --- src/compiler/checker.ts | 23 ++--------------------- src/compiler/utilities.ts | 37 ++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b466bf7afb6..26dd39d6b92 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3156,30 +3156,11 @@ namespace ts { function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType { // First, see if this node has an @type annotation on it directly. - const typeTag = getJSDocTypeTag(declaration); + const typeTag = getJSDocTypeTag(declaration, true); if (typeTag && typeTag.typeExpression) { return typeTag.typeExpression.type; } - if (declaration.kind === SyntaxKind.VariableDeclaration && - declaration.parent.kind === SyntaxKind.VariableDeclarationList && - declaration.parent.parent.kind === SyntaxKind.VariableStatement) { - - // @type annotation might have been on the variable statement, try that instead. - const annotation = getJSDocTypeTag(declaration.parent.parent); - if (annotation && annotation.typeExpression) { - return annotation.typeExpression.type; - } - } - else if (declaration.kind === SyntaxKind.Parameter) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - const paramTag = getCorrespondingJSDocParameterTag(declaration); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type; - } - } - return undefined; } @@ -13551,7 +13532,7 @@ namespace ts { // the destructured type into the contained binding elements. function assignBindingElementTypes(node: VariableLikeDeclaration) { if (isBindingPattern(node.name)) { - for (const element of (node.name).elements) { + for (const element of node.name.elements) { if (!isOmittedExpression(element)) { if (element.name.kind === SyntaxKind.Identifier) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 158da8e8f0b..16255dfdde7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1449,10 +1449,16 @@ namespace ts { }, tags => tags); } - function getJSDocs(node: Node, checkParentVariableStatement: boolean, getDocs: (docs: JSDoc[]) => T[], getTags: (tags: JSDocTag[]) => T[]): T[] { + function getJSDocs(node: Node, + checkParentVariableStatement: boolean, + getDocContent: (docs: JSDoc[]) => T[], + getTagContent: (tags: JSDocTag[]) => T[]): T[] { // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... + // This will be hard because it may need to cache parentvariable versions and nonparent versions + // maybe I should eliminate checkParent first ... let result: T[] = undefined; // prepend documentation from parent sources + // TODO: Probably always want checkParent=true, right? if (checkParentVariableStatement) { // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. // /** @@ -1472,11 +1478,11 @@ namespace ts { isVariableOfVariableDeclarationStatement ? node.parent.parent : undefined; if (variableStatementNode) { - result = concatenate(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocContent, getTagContent)); } if (node.kind === SyntaxKind.ModuleDeclaration && node.parent && node.parent.kind === SyntaxKind.ModuleDeclaration) { - result = concatenate(result, getJSDocs(node.parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(node.parent, checkParentVariableStatement, getDocContent, getTagContent)); } // Also recognize when the node is the RHS of an assignment expression @@ -1487,33 +1493,34 @@ namespace ts { (parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken && parent.parent.kind === SyntaxKind.ExpressionStatement; if (isSourceOfAssignmentExpressionStatement) { - result = concatenate(result, getJSDocs(parent.parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(parent.parent, checkParentVariableStatement, getDocContent, getTagContent)); } const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment; if (isPropertyAssignmentExpression) { - result = concatenate(result, getJSDocs(parent, checkParentVariableStatement, getDocs, getTags)); + result = concatenate(result, getJSDocs(parent, checkParentVariableStatement, getDocContent, getTagContent)); } // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { const paramTags = getJSDocParameterTag(node as ParameterDeclaration, checkParentVariableStatement); if (paramTags) { - result = concatenate(result, getTags(paramTags)); + result = concatenate(result, getTagContent(paramTags)); } } } if (isVariableLike(node) && node.initializer) { - result = concatenate(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocs, getTags)); + // TODO: Does this really need to be called for everything? + result = concatenate(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocContent, getTagContent)); } if (node.jsDocComments) { if (result) { - result = concatenate(result, getDocs(node.jsDocComments)); + result = concatenate(result, getDocContent(node.jsDocComments)); } else { - return getDocs(node.jsDocComments); + return getDocContent(node.jsDocComments); } } @@ -1521,6 +1528,7 @@ namespace ts { } function getJSDocParameterTag(param: ParameterDeclaration, checkParentVariableStatement: boolean): JSDocTag[] { + // TODO: getCorrespondingJSDocParameterTag is basically the same as this, except worse. (and typed, singleton return) const func = param.parent as FunctionLikeDeclaration; const tags = getJSDocTags(func, checkParentVariableStatement); if (!param.name) { @@ -1545,16 +1553,19 @@ namespace ts { } } - export function getJSDocTypeTag(node: Node): JSDocTypeTag { - return getJSDocTag(node, SyntaxKind.JSDocTypeTag, /*checkParentVariableStatement*/ false); + export function getJSDocTypeTag(node: Node, checkParentVariableStatement?: boolean): JSDocTypeTag | JSDocParameterTag { + // TODO: Get rid of the second parameter again + // TODO: Don't call getJSDocTag twice. Call a version that allows you to retrieve either kind. + return getJSDocTag(node, SyntaxKind.JSDocTypeTag, checkParentVariableStatement) as JSDocTypeTag || + node.kind === SyntaxKind.Parameter && firstOrUndefined(getJSDocParameterTag(node as ParameterDeclaration, checkParentVariableStatement)) as JSDocParameterTag; } export function getJSDocReturnTag(node: Node): JSDocReturnTag { - return getJSDocTag(node, SyntaxKind.JSDocReturnTag, /*checkParentVariableStatement*/ true); + return getJSDocTag(node, SyntaxKind.JSDocReturnTag, /*checkParentVariableStatement*/ true) as JSDocReturnTag; } export function getJSDocTemplateTag(node: Node): JSDocTemplateTag { - return getJSDocTag(node, SyntaxKind.JSDocTemplateTag, /*checkParentVariableStatement*/ false); + return getJSDocTag(node, SyntaxKind.JSDocTemplateTag, /*checkParentVariableStatement*/ false) as JSDocTemplateTag; } export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag { From 5a05b94fb5e03eed15f6b687f6ec490c5d685aa5 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 17 Nov 2016 13:27:57 -0800 Subject: [PATCH 03/41] Clean up getJSDocs 1. Get rid of parent check. 2. Use a couple of nested functions, one of them a recursive worker. --- src/compiler/checker.ts | 27 +++------ src/compiler/utilities.ts | 118 ++++++++++++++++++-------------------- src/services/jsDoc.ts | 2 +- 3 files changed, 67 insertions(+), 80 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 26dd39d6b92..53571e265ea 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3148,19 +3148,10 @@ namespace ts { } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration) { - const jsDocType = getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return getTypeFromTypeNode(jsDocType); + const jsdocType = getJSDocType(declaration); + if (jsdocType) { + return getTypeFromTypeNode(jsdocType); } - } - - function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType { - // First, see if this node has an @type annotation on it directly. - const typeTag = getJSDocTypeTag(declaration, true); - if (typeTag && typeTag.typeExpression) { - return typeTag.typeExpression.type; - } - return undefined; } @@ -3426,9 +3417,9 @@ namespace ts { declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) { // Use JS Doc type if present on parent expression statement if (declaration.flags & NodeFlags.JavaScriptFile) { - const typeTag = getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + const jsdocType = getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } const declaredTypes = map(symbol.declarations, @@ -10296,9 +10287,9 @@ namespace ts { } function getTypeForThisExpressionFromJSDoc(node: Node) { - const typeTag = getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === SyntaxKind.JSDocFunctionType) { - const jsDocFunctionType = typeTag.typeExpression.type; + const jsdocType = getJSDocType(node); + if (jsdocType && jsdocType.kind === SyntaxKind.JSDocFunctionType) { + const jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === SyntaxKind.JSDocThisType) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 16255dfdde7..a0ac380711c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1416,12 +1416,12 @@ namespace ts { (node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType; } - function getJSDocTag(node: Node, kind: SyntaxKind, checkParentVariableStatement: boolean): JSDocTag { + function getJSDocTag(node: Node, kind: SyntaxKind): JSDocTag { if (!node) { return undefined; } - const jsDocTags = getJSDocTags(node, checkParentVariableStatement); + const jsDocTags = getJSDocTags(node); if (!jsDocTags) { return undefined; } @@ -1433,12 +1433,12 @@ namespace ts { } } - export function getJSDocComments(node: Node, checkParentVariableStatement: boolean): string[] { - return getJSDocs(node, checkParentVariableStatement, docs => map(docs, doc => doc.comment), tags => map(tags, tag => tag.comment)); + export function getJSDocComments(node: Node): string[] { + return getJSDocs(node, docs => map(docs, doc => doc.comment), tags => map(tags, tag => tag.comment)); } - function getJSDocTags(node: Node, checkParentVariableStatement: boolean): JSDocTag[] { - return getJSDocs(node, checkParentVariableStatement, docs => { + function getJSDocTags(node: Node): JSDocTag[] { + return getJSDocs(node, docs => { const result: JSDocTag[] = []; for (const doc of docs) { if (doc.tags) { @@ -1449,17 +1449,16 @@ namespace ts { }, tags => tags); } - function getJSDocs(node: Node, - checkParentVariableStatement: boolean, - getDocContent: (docs: JSDoc[]) => T[], - getTagContent: (tags: JSDocTag[]) => T[]): T[] { - // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... - // This will be hard because it may need to cache parentvariable versions and nonparent versions - // maybe I should eliminate checkParent first ... - let result: T[] = undefined; - // prepend documentation from parent sources - // TODO: Probably always want checkParent=true, right? - if (checkParentVariableStatement) { + function getJSDocs(node: Node, getContent: (docs: JSDoc[]) => T[], getContentFromParam: (tags: JSDocTag[]) => T[]): T[] { + return getJSDocsWorker(node); + + function getJSDocsWorker(node: Node) { + // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... + // This will be hard because it may need to cache parentvariable versions and nonparent versions + // maybe I should eliminate checkParent first ... + const parent = node.parent; + let result: T[] = undefined; + // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. // /** // * @param {number} name @@ -1467,70 +1466,61 @@ namespace ts { // */ // var x = function(name) { return name.length; } const isInitializerOfVariableDeclarationInStatement = - isVariableLike(node.parent) && - (node.parent).initializer === node && - node.parent.parent.parent.kind === SyntaxKind.VariableStatement; + isVariableLike(parent) && + parent.initializer === node && + parent.parent.parent.kind === SyntaxKind.VariableStatement; const isVariableOfVariableDeclarationStatement = isVariableLike(node) && - node.parent.parent.kind === SyntaxKind.VariableStatement; - + parent.parent.kind === SyntaxKind.VariableStatement; const variableStatementNode = - isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : - isVariableOfVariableDeclarationStatement ? node.parent.parent : - undefined; + isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : + undefined; if (variableStatementNode) { - result = concatenate(result, getJSDocs(variableStatementNode, checkParentVariableStatement, getDocContent, getTagContent)); - } - if (node.kind === SyntaxKind.ModuleDeclaration && - node.parent && node.parent.kind === SyntaxKind.ModuleDeclaration) { - result = concatenate(result, getJSDocs(node.parent, checkParentVariableStatement, getDocContent, getTagContent)); + result = concatenate(result, getJSDocsWorker(variableStatementNode)); } // Also recognize when the node is the RHS of an assignment expression - const parent = node.parent; const isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === SyntaxKind.BinaryExpression && (parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken && parent.parent.kind === SyntaxKind.ExpressionStatement; if (isSourceOfAssignmentExpressionStatement) { - result = concatenate(result, getJSDocs(parent.parent, checkParentVariableStatement, getDocContent, getTagContent)); + result = concatenate(result, getJSDocsWorker(parent.parent)); } + const isModuleDeclaration = node.kind === SyntaxKind.ModuleDeclaration && + parent && parent.kind === SyntaxKind.ModuleDeclaration; const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment; - if (isPropertyAssignmentExpression) { - result = concatenate(result, getJSDocs(parent, checkParentVariableStatement, getDocContent, getTagContent)); + if (isModuleDeclaration || isPropertyAssignmentExpression) { + result = concatenate(result, getJSDocsWorker(parent)); } // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { - const paramTags = getJSDocParameterTag(node as ParameterDeclaration, checkParentVariableStatement); - if (paramTags) { - result = concatenate(result, getTagContent(paramTags)); - } + result = concatenate(result, getContentFromParam(getJSDocParameterTag(node as ParameterDeclaration))); } + + if (isVariableLike(node) && node.initializer) { + result = concatenate(result, getOwnJSDocs(node.initializer)); + } + + result = concatenate(result, getOwnJSDocs(node)); + + return result; } - if (isVariableLike(node) && node.initializer) { - // TODO: Does this really need to be called for everything? - result = concatenate(result, getJSDocs(node.initializer, /*checkParentVariableStatement*/ false, getDocContent, getTagContent)); - } - - if (node.jsDocComments) { - if (result) { - result = concatenate(result, getDocContent(node.jsDocComments)); - } - else { - return getDocContent(node.jsDocComments); + function getOwnJSDocs(node: Node) { + if (node.jsDocComments) { + return getContent(node.jsDocComments); } } - - return result; } - function getJSDocParameterTag(param: ParameterDeclaration, checkParentVariableStatement: boolean): JSDocTag[] { + function getJSDocParameterTag(param: ParameterDeclaration): JSDocTag[] { // TODO: getCorrespondingJSDocParameterTag is basically the same as this, except worse. (and typed, singleton return) const func = param.parent as FunctionLikeDeclaration; - const tags = getJSDocTags(func, checkParentVariableStatement); + const tags = getJSDocTags(func); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification const i = func.parameters.indexOf(param); @@ -1553,19 +1543,25 @@ namespace ts { } } - export function getJSDocTypeTag(node: Node, checkParentVariableStatement?: boolean): JSDocTypeTag | JSDocParameterTag { - // TODO: Get rid of the second parameter again - // TODO: Don't call getJSDocTag twice. Call a version that allows you to retrieve either kind. - return getJSDocTag(node, SyntaxKind.JSDocTypeTag, checkParentVariableStatement) as JSDocTypeTag || - node.kind === SyntaxKind.Parameter && firstOrUndefined(getJSDocParameterTag(node as ParameterDeclaration, checkParentVariableStatement)) as JSDocParameterTag; + export function getJSDocType(node: Node): JSDocType { + // TODO: If you have to call getparamtag, you really want the first with a typeExpression, not the first one. + let tag: JSDocTypeTag | JSDocParameterTag = getJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; + if (!tag && node.kind === SyntaxKind.Parameter) { + const paramTags = getJSDocParameterTag(node as ParameterDeclaration); + if (paramTags) { + tag = find(paramTags, tag => !!(tag as JSDocParameterTag).typeExpression) as JSDocParameterTag; + } + } + + return tag && tag.typeExpression && tag.typeExpression.type; } export function getJSDocReturnTag(node: Node): JSDocReturnTag { - return getJSDocTag(node, SyntaxKind.JSDocReturnTag, /*checkParentVariableStatement*/ true) as JSDocReturnTag; + return getJSDocTag(node, SyntaxKind.JSDocReturnTag) as JSDocReturnTag; } export function getJSDocTemplateTag(node: Node): JSDocTemplateTag { - return getJSDocTag(node, SyntaxKind.JSDocTemplateTag, /*checkParentVariableStatement*/ false) as JSDocTemplateTag; + return getJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag; } export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag { @@ -1574,7 +1570,7 @@ namespace ts { // annotation. const parameterName = (parameter.name).text; - const jsDocTags = getJSDocTags(parameter.parent, /*checkParentVariableStatement*/ true); + const jsDocTags = getJSDocTags(parameter.parent); if (!jsDocTags) { return undefined; } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 5e2f5e7b4c9..24e99cf5c77 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -52,7 +52,7 @@ namespace ts.JsDoc { // from Array - Array and Array const documentationComment = []; forEachUnique(declarations, declaration => { - const comments = getJSDocComments(declaration, /*checkParentVariableStatement*/ true); + const comments = getJSDocComments(declaration); if (!comments) { return; } From ddffe209f9ab8ee31cae9088688e34cadf255da3 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 17 Nov 2016 14:26:38 -0800 Subject: [PATCH 04/41] Clean up getJSDocParameterTag And delete its near-duplicate which was much less correct. The callers that had to switch are slightly more complex and more correct now. --- src/compiler/checker.ts | 17 ++++++------ src/compiler/utilities.ts | 56 +++++++++------------------------------ 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 53571e265ea..0803814bc14 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4854,15 +4854,16 @@ namespace ts { if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) { return true; } + const paramTags = getJSDocParameterTag(node); + if (paramTags) { + for (const paramTag of paramTags) { + if (paramTag.isBracketed) { + return true; + } - const paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag) { - if (paramTag.isBracketed) { - return true; - } - - if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType; + if (paramTag.typeExpression) { + return paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType; + } } } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a0ac380711c..243d4f4c519 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1498,16 +1498,14 @@ namespace ts { // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { - result = concatenate(result, getContentFromParam(getJSDocParameterTag(node as ParameterDeclaration))); + result = concatenate(result, getContentFromParam(getJSDocParameterTag(node))); } if (isVariableLike(node) && node.initializer) { result = concatenate(result, getOwnJSDocs(node.initializer)); } - result = concatenate(result, getOwnJSDocs(node)); - - return result; + return concatenate(result, getOwnJSDocs(node)); } function getOwnJSDocs(node: Node) { @@ -1517,24 +1515,23 @@ namespace ts { } } - function getJSDocParameterTag(param: ParameterDeclaration): JSDocTag[] { - // TODO: getCorrespondingJSDocParameterTag is basically the same as this, except worse. (and typed, singleton return) + export function getJSDocParameterTag(param: Node): JSDocParameterTag[] { + if (!isParameter(param)) { + return undefined; + } const func = param.parent as FunctionLikeDeclaration; const tags = getJSDocTags(func); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification const i = func.parameters.indexOf(param); - const paramTags = filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag); + const paramTags = filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag) as JSDocParameterTag[]; if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === SyntaxKind.Identifier) { const name = (param.name as Identifier).text; - const paramTags = filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag && (tag as JSDocParameterTag).parameterName.text === name); - if (paramTags) { - return paramTags; - } + return filter(tags as JSDocParameterTag[], tag => tag.kind === SyntaxKind.JSDocParameterTag && tag.parameterName.text === name); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -1544,12 +1541,11 @@ namespace ts { } export function getJSDocType(node: Node): JSDocType { - // TODO: If you have to call getparamtag, you really want the first with a typeExpression, not the first one. let tag: JSDocTypeTag | JSDocParameterTag = getJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; if (!tag && node.kind === SyntaxKind.Parameter) { - const paramTags = getJSDocParameterTag(node as ParameterDeclaration); + const paramTags = getJSDocParameterTag(node); if (paramTags) { - tag = find(paramTags, tag => !!(tag as JSDocParameterTag).typeExpression) as JSDocParameterTag; + tag = find(paramTags, tag => !!tag.typeExpression); } } @@ -1564,29 +1560,6 @@ namespace ts { return getJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag; } - export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag { - if (parameter.name && parameter.name.kind === SyntaxKind.Identifier) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - const parameterName = (parameter.name).text; - - const jsDocTags = getJSDocTags(parameter.parent); - if (!jsDocTags) { - return undefined; - } - for (const tag of jsDocTags) { - if (tag.kind === SyntaxKind.JSDocParameterTag) { - const parameterTag = tag; - if (parameterTag.parameterName.text === parameterName) { - return parameterTag; - } - } - } - } - - return undefined; - } - export function hasRestParameter(s: SignatureDeclaration): boolean { return isRestParameter(lastOrUndefined(s.parameters)); } @@ -1597,14 +1570,11 @@ namespace ts { export function isRestParameter(node: ParameterDeclaration) { if (node && (node.flags & NodeFlags.JavaScriptFile)) { - if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType) { + if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType || + forEach(getJSDocParameterTag(node), + t => t.typeExpression && t.typeExpression.type.kind === SyntaxKind.JSDocVariadicType)) { return true; } - - const paramTag = getCorrespondingJSDocParameterTag(node); - if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === SyntaxKind.JSDocVariadicType; - } } return isDeclaredRestParam(node); } From e81cfa10d6c670381ee0bb9823632df34bf57ab2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 17 Nov 2016 15:32:16 -0800 Subject: [PATCH 05/41] Clean cache code and streamline other code Cache only uses one property now. getJSDocs isn't generic and doesn't take a function parameter any more. The code is overall easier to read. --- src/compiler/types.ts | 1 + src/compiler/utilities.ts | 83 +++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 48 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index af46cb2173c..8b648000273 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -498,6 +498,7 @@ namespace ts { /* @internal */ original?: Node; // The original node if this is an updated node. /* @internal */ startsOnNewLine?: boolean; // Whether a synthesized node should start on a new line (used by transforms). /* @internal */ jsDocComments?: JSDoc[]; // JSDoc for the node, if it has any. + /* @internal */ jsDocCache?: (JSDoc | JSDocParameterTag)[]; // JSDoc for the node, plus JSDoc retrieved from its parents /* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding) /* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding) /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 243d4f4c519..e5fd8b067b0 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1416,49 +1416,42 @@ namespace ts { (node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType; } - function getJSDocTag(node: Node, kind: SyntaxKind): JSDocTag { - if (!node) { - return undefined; - } - - const jsDocTags = getJSDocTags(node); - if (!jsDocTags) { - return undefined; - } - - for (const tag of jsDocTags) { - if (tag.kind === kind) { - return tag; - } - } - } - export function getJSDocComments(node: Node): string[] { - return getJSDocs(node, docs => map(docs, doc => doc.comment), tags => map(tags, tag => tag.comment)); + return map(getJSDocs(node), doc => doc.comment); } - function getJSDocTags(node: Node): JSDocTag[] { - return getJSDocs(node, docs => { + function getJSDocTags(node: Node, kind: SyntaxKind): JSDocTag[] { + const docs = getJSDocs(node); + if (docs) { const result: JSDocTag[] = []; for (const doc of docs) { - if (doc.tags) { - result.push(...doc.tags); + if (doc.kind === SyntaxKind.JSDocParameterTag) { + if (doc.kind === kind) { + result.push(doc as JSDocParameterTag); + } + } + else { + result.push(...filter((doc as JSDoc).tags, tag => tag.kind === kind)); } } return result; - }, tags => tags); + } } - function getJSDocs(node: Node, getContent: (docs: JSDoc[]) => T[], getContentFromParam: (tags: JSDocTag[]) => T[]): T[] { - return getJSDocsWorker(node); + function getFirstJSDocTag(node: Node, kind: SyntaxKind): JSDocTag { + return node && firstOrUndefined(getJSDocTags(node, kind)); + } + + function getJSDocs(node: Node): (JSDoc | JSDocParameterTag)[] { + let cache: (JSDoc | JSDocParameterTag)[] = node.jsDocCache; + if (!cache) { + getJSDocsWorker(node); + node.jsDocCache = cache; + } + return cache; function getJSDocsWorker(node: Node) { - // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now... - // This will be hard because it may need to cache parentvariable versions and nonparent versions - // maybe I should eliminate checkParent first ... const parent = node.parent; - let result: T[] = undefined; - // Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement. // /** // * @param {number} name @@ -1476,7 +1469,7 @@ namespace ts { isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - result = concatenate(result, getJSDocsWorker(variableStatementNode)); + getJSDocsWorker(variableStatementNode); } // Also recognize when the node is the RHS of an assignment expression @@ -1486,32 +1479,26 @@ namespace ts { (parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken && parent.parent.kind === SyntaxKind.ExpressionStatement; if (isSourceOfAssignmentExpressionStatement) { - result = concatenate(result, getJSDocsWorker(parent.parent)); + getJSDocsWorker(parent.parent); } const isModuleDeclaration = node.kind === SyntaxKind.ModuleDeclaration && parent && parent.kind === SyntaxKind.ModuleDeclaration; const isPropertyAssignmentExpression = parent && parent.kind === SyntaxKind.PropertyAssignment; if (isModuleDeclaration || isPropertyAssignmentExpression) { - result = concatenate(result, getJSDocsWorker(parent)); + getJSDocsWorker(parent); } // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { - result = concatenate(result, getContentFromParam(getJSDocParameterTag(node))); + cache = concatenate(cache, getJSDocParameterTag(node)); } if (isVariableLike(node) && node.initializer) { - result = concatenate(result, getOwnJSDocs(node.initializer)); + cache = concatenate(cache, node.initializer.jsDocComments); } - return concatenate(result, getOwnJSDocs(node)); - } - - function getOwnJSDocs(node: Node) { - if (node.jsDocComments) { - return getContent(node.jsDocComments); - } + cache = concatenate(cache, node.jsDocComments); } } @@ -1520,18 +1507,18 @@ namespace ts { return undefined; } const func = param.parent as FunctionLikeDeclaration; - const tags = getJSDocTags(func); + const tags = getJSDocTags(func, SyntaxKind.JSDocParameterTag) as JSDocParameterTag[]; if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification const i = func.parameters.indexOf(param); - const paramTags = filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag) as JSDocParameterTag[]; + const paramTags = filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === SyntaxKind.Identifier) { const name = (param.name as Identifier).text; - return filter(tags as JSDocParameterTag[], tag => tag.kind === SyntaxKind.JSDocParameterTag && tag.parameterName.text === name); + return filter(tags, tag => tag.kind === SyntaxKind.JSDocParameterTag && tag.parameterName.text === name); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -1541,7 +1528,7 @@ namespace ts { } export function getJSDocType(node: Node): JSDocType { - let tag: JSDocTypeTag | JSDocParameterTag = getJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; + let tag: JSDocTypeTag | JSDocParameterTag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; if (!tag && node.kind === SyntaxKind.Parameter) { const paramTags = getJSDocParameterTag(node); if (paramTags) { @@ -1553,11 +1540,11 @@ namespace ts { } export function getJSDocReturnTag(node: Node): JSDocReturnTag { - return getJSDocTag(node, SyntaxKind.JSDocReturnTag) as JSDocReturnTag; + return getFirstJSDocTag(node, SyntaxKind.JSDocReturnTag) as JSDocReturnTag; } export function getJSDocTemplateTag(node: Node): JSDocTemplateTag { - return getJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag; + return getFirstJSDocTag(node, SyntaxKind.JSDocTemplateTag) as JSDocTemplateTag; } export function hasRestParameter(s: SignatureDeclaration): boolean { From aa0d2ce2eea83ddc67d45af74bb3e7eb55710d16 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 18 Nov 2016 06:55:03 -0800 Subject: [PATCH 06/41] Make "exclude" default to empty if "include" is present. --- src/compiler/commandLineParser.ts | 4 +-- src/harness/unittests/matchFiles.ts | 48 ++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 26877de43c4..7a6476818f7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -951,8 +951,8 @@ namespace ts { errors.push(createCompilerDiagnostic(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"]; const outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; if (outDir) { diff --git a/src/harness/unittests/matchFiles.ts b/src/harness/unittests/matchFiles.ts index b514ac142c5..c562fcefe91 100644 --- a/src/harness/unittests/matchFiles.ts +++ b/src/harness/unittests/matchFiles.ts @@ -89,8 +89,6 @@ namespace ts { "c:/dev/g.min.js/.g/g.ts" ]); - const defaultExcludes = ["node_modules", "bower_components", "jspm_packages"]; - function assertParsed(actual: ts.ParsedCommandLine, expected: ts.ParsedCommandLine): void { assert.deepEqual(actual.fileNames, expected.fileNames); assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories); @@ -98,6 +96,23 @@ namespace ts { } describe("matchFiles", () => { + it("with defaults", () => { + const json = {}; + const expected: ts.ParsedCommandLine = { + options: {}, + errors: [], + fileNames: [ + "c:/dev/a.ts", + "c:/dev/b.ts" + ], + wildcardDirectories: { + "c:/dev": ts.WatchDirectoryFlags.Recursive + }, + }; + const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath); + assertParsed(actual, expected); + }); + describe("with literal file list", () => { it("without exclusions", () => { const json = { @@ -192,7 +207,7 @@ namespace ts { options: {}, errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {}, @@ -211,7 +226,7 @@ namespace ts { options: {}, errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {}, @@ -330,7 +345,10 @@ namespace ts { errors: [], fileNames: [ "c:/dev/a.ts", - "c:/dev/b.ts" + "c:/dev/b.ts", + "c:/dev/bower_components/a.ts", + "c:/dev/jspm_packages/a.ts", + "c:/dev/node_modules/a.ts" ], wildcardDirectories: {}, }; @@ -372,8 +390,7 @@ namespace ts { "node_modules/a.ts", "bower_components/a.ts", "jspm_packages/a.ts" - ], - exclude: [] + ] }; const expected: ts.ParsedCommandLine = { options: {}, @@ -530,7 +547,7 @@ namespace ts { options: {}, errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: { @@ -600,7 +617,10 @@ namespace ts { options: {}, errors: [], fileNames: [ - "c:/dev/a.ts" + "c:/dev/a.ts", + "c:/dev/bower_components/a.ts", + "c:/dev/jspm_packages/a.ts", + "c:/dev/node_modules/a.ts" ], wildcardDirectories: { "c:/dev": ts.WatchDirectoryFlags.Recursive @@ -671,7 +691,7 @@ namespace ts { }, errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: { @@ -980,7 +1000,7 @@ namespace ts { errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**"), ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {} @@ -1022,7 +1042,7 @@ namespace ts { errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, "**/x/**/*"), ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {} @@ -1071,7 +1091,7 @@ namespace ts { errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/../*"), ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {} @@ -1091,7 +1111,7 @@ namespace ts { errors: [ ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/y/../*"), ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, - caseInsensitiveTsconfigPath, JSON.stringify(json.include), JSON.stringify(defaultExcludes)) + caseInsensitiveTsconfigPath, JSON.stringify(json.include), "[]") ], fileNames: [], wildcardDirectories: {} From ab84cd0647719a468e4bd6f7b911a094fe7c685d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 18 Nov 2016 15:03:40 -0800 Subject: [PATCH 07/41] Improve readability of types and names --- src/compiler/checker.ts | 2 +- src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0803814bc14..94bbd8823e9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4854,7 +4854,7 @@ namespace ts { if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) { return true; } - const paramTags = getJSDocParameterTag(node); + const paramTags = getJSDocParameterTags(node); if (paramTags) { for (const paramTag of paramTags) { if (paramTag.isBracketed) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8b648000273..51805228e48 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -498,7 +498,7 @@ namespace ts { /* @internal */ original?: Node; // The original node if this is an updated node. /* @internal */ startsOnNewLine?: boolean; // Whether a synthesized node should start on a new line (used by transforms). /* @internal */ jsDocComments?: JSDoc[]; // JSDoc for the node, if it has any. - /* @internal */ jsDocCache?: (JSDoc | JSDocParameterTag)[]; // JSDoc for the node, plus JSDoc retrieved from its parents + /* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // JSDoc for the node, plus JSDoc and tags retrieved from its parents /* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding) /* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding) /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e5fd8b067b0..08eaa8033ae 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1427,7 +1427,7 @@ namespace ts { for (const doc of docs) { if (doc.kind === SyntaxKind.JSDocParameterTag) { if (doc.kind === kind) { - result.push(doc as JSDocParameterTag); + result.push(doc as JSDocTag); } } else { @@ -1442,8 +1442,8 @@ namespace ts { return node && firstOrUndefined(getJSDocTags(node, kind)); } - function getJSDocs(node: Node): (JSDoc | JSDocParameterTag)[] { - let cache: (JSDoc | JSDocParameterTag)[] = node.jsDocCache; + function getJSDocs(node: Node): (JSDoc | JSDocTag)[] { + let cache: (JSDoc | JSDocTag)[] = node.jsDocCache; if (!cache) { getJSDocsWorker(node); node.jsDocCache = cache; @@ -1491,7 +1491,7 @@ namespace ts { // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { - cache = concatenate(cache, getJSDocParameterTag(node)); + cache = concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -1502,7 +1502,7 @@ namespace ts { } } - export function getJSDocParameterTag(param: Node): JSDocParameterTag[] { + export function getJSDocParameterTags(param: Node): JSDocParameterTag[] { if (!isParameter(param)) { return undefined; } @@ -1530,7 +1530,7 @@ namespace ts { export function getJSDocType(node: Node): JSDocType { let tag: JSDocTypeTag | JSDocParameterTag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; if (!tag && node.kind === SyntaxKind.Parameter) { - const paramTags = getJSDocParameterTag(node); + const paramTags = getJSDocParameterTags(node); if (paramTags) { tag = find(paramTags, tag => !!tag.typeExpression); } @@ -1558,7 +1558,7 @@ namespace ts { export function isRestParameter(node: ParameterDeclaration) { if (node && (node.flags & NodeFlags.JavaScriptFile)) { if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType || - forEach(getJSDocParameterTag(node), + forEach(getJSDocParameterTags(node), t => t.typeExpression && t.typeExpression.type.kind === SyntaxKind.JSDocVariadicType)) { return true; } From 7caee79ce7aa698a84f98f7a88796d56c5e90624 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 18 Nov 2016 15:10:19 -0800 Subject: [PATCH 08/41] Rename getJSDocComments -> getCommentsFromJSDoc --- src/compiler/utilities.ts | 2 +- src/services/jsDoc.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 08eaa8033ae..5669ac9be8d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1416,7 +1416,7 @@ namespace ts { (node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType; } - export function getJSDocComments(node: Node): string[] { + export function getCommentsFromJSDoc(node: Node): string[] { return map(getJSDocs(node), doc => doc.comment); } diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 24e99cf5c77..3369ac23223 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -52,7 +52,7 @@ namespace ts.JsDoc { // from Array - Array and Array const documentationComment = []; forEachUnique(declarations, declaration => { - const comments = getJSDocComments(declaration); + const comments = getCommentsFromJSDoc(declaration); if (!comments) { return; } From 91e6bce34c3a2d771b815cd73c176018186b31b5 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 18 Nov 2016 15:44:15 -0800 Subject: [PATCH 09/41] Address PR comments --- src/compiler/binder.ts | 4 ++-- src/compiler/parser.ts | 20 ++++++++++---------- src/compiler/types.ts | 4 ++-- src/compiler/utilities.ts | 12 ++++++------ src/services/navigationBar.ts | 4 ++-- src/services/services.ts | 6 +++--- src/services/utilities.ts | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1afe51db021..c2bfce10e57 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -599,8 +599,8 @@ namespace ts { // 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 (isInJavaScriptFile(node) && node.jsDocComments) { - forEach(node.jsDocComments, bind); + if (isInJavaScriptFile(node) && node.jsDoc) { + forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { bindEachChild(node); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a3c21eaf8dc..d286a9d9dac 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -689,10 +689,10 @@ namespace ts { continue; } - if (!node.jsDocComments) { - node.jsDocComments = []; + if (!node.jsDoc) { + node.jsDoc = []; } - node.jsDocComments.push(jsDoc); + node.jsDoc.push(jsDoc); } } @@ -719,11 +719,11 @@ namespace ts { const saveParent = parent; parent = n; forEachChild(n, visitNode); - if (n.jsDocComments) { - for (const jsDocComment of n.jsDocComments) { - jsDocComment.parent = n; - parent = jsDocComment; - forEachChild(jsDocComment, visitNode); + if (n.jsDoc) { + for (const jsDoc of n.jsDoc) { + jsDoc.parent = n; + parent = jsDoc; + forEachChild(jsDoc, visitNode); } } parent = saveParent; @@ -6954,8 +6954,8 @@ namespace ts { } forEachChild(node, visitNode, visitArray); - if (node.jsDocComments) { - for (const jsDocComment of node.jsDocComments) { + if (node.jsDoc) { + for (const jsDocComment of node.jsDoc) { forEachChild(jsDocComment, visitNode, visitArray); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 51805228e48..2a4b9e66d82 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -497,8 +497,8 @@ namespace ts { parent?: Node; // Parent node (initialized by binding) /* @internal */ original?: Node; // The original node if this is an updated node. /* @internal */ startsOnNewLine?: boolean; // Whether a synthesized node should start on a new line (used by transforms). - /* @internal */ jsDocComments?: JSDoc[]; // JSDoc for the node, if it has any. - /* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // JSDoc for the node, plus JSDoc and tags retrieved from its parents + /* @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node + /* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // All JSDoc that applies to the node, including parent docs and @param tags /* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding) /* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding) /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5669ac9be8d..1d14854cd1f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -239,7 +239,7 @@ namespace ts { return !nodeIsMissing(node); } - export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDocComment?: boolean): number { + export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number { // 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)) { @@ -250,8 +250,8 @@ namespace ts { return 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 @@ -259,7 +259,7 @@ namespace ts { // 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 === SyntaxKind.SyntaxList && (node)._children.length > 0) { - return getTokenPosOfNode((node)._children[0], sourceFile, includeJsDocComment); + return getTokenPosOfNode((node)._children[0], sourceFile, includeJsDoc); } return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -1495,10 +1495,10 @@ namespace ts { } if (isVariableLike(node) && node.initializer) { - cache = concatenate(cache, node.initializer.jsDocComments); + cache = concatenate(cache, node.initializer.jsDoc); } - cache = concatenate(cache, node.jsDocComments); + cache = concatenate(cache, node.jsDoc); } } diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 51ce9b6001d..1cbaa3d640f 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -225,8 +225,8 @@ namespace ts.NavigationBar { break; default: - forEach(node.jsDocComments, jsDocComment => { - forEach(jsDocComment.tags, tag => { + forEach(node.jsDoc, jsDoc => { + forEach(jsDoc.tags, tag => { if (tag.kind === SyntaxKind.JSDocTypedefTag) { addLeafNode(tag); } diff --git a/src/services/services.ts b/src/services/services.ts index 3c0b7838314..f826a8850fe 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1956,9 +1956,9 @@ namespace ts { break; default: forEachChild(node, walk); - if (node.jsDocComments) { - for (const jsDocComment of node.jsDocComments) { - forEachChild(jsDocComment, walk); + if (node.jsDoc) { + for (const jsDoc of node.jsDoc) { + forEachChild(jsDoc, walk); } } } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 82b13f82327..e19fdc0a84a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -951,10 +951,10 @@ namespace ts { } if (node) { - if (node.jsDocComments) { - for (const jsDocComment of node.jsDocComments) { - if (jsDocComment.tags) { - for (const tag of jsDocComment.tags) { + if (node.jsDoc) { + for (const jsDoc of node.jsDoc) { + if (jsDoc.tags) { + for (const tag of jsDoc.tags) { if (tag.pos <= position && position <= tag.end) { return tag; } From 0c5429d3b704e557c5be8573a6faba4da30f10a2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 18 Nov 2016 15:48:31 -0800 Subject: [PATCH 10/41] Add missed jsDoc rename in services' Node implementation Why would you implement an interface using a *class*? --- src/services/services.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index f826a8850fe..847967b2be9 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -45,7 +45,7 @@ namespace ts { public end: number; public flags: NodeFlags; public parent: Node; - public jsDocComments: JSDoc[]; + public jsDoc: JSDoc[]; public original: Node; public transformFlags: TransformFlags; private _children: Node[]; @@ -154,8 +154,8 @@ namespace ts { pos = nodes.end; }; // jsDocComments need to be the first children - if (this.jsDocComments) { - for (const jsDocComment of this.jsDocComments) { + if (this.jsDoc) { + for (const jsDocComment of this.jsDoc) { processNode(jsDocComment); } } From 5a9451ae238925d27f7ba14c58083339605c30a9 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Fri, 18 Nov 2016 17:46:06 -0800 Subject: [PATCH 11/41] Rename typingOptions.enableAutoDiscovery to typeAcquisition.enable --- Jakefile.js | 2 +- src/compiler/commandLineParser.ts | 24 ++--- src/compiler/diagnosticMessages.json | 2 +- src/compiler/types.ts | 8 +- src/harness/tsconfig.json | 2 +- ...n.ts => convertTypeAcquisitionFromJson.ts} | 90 +++++++++---------- .../unittests/tsserverProjectSystem.ts | 8 +- src/harness/unittests/typingsInstaller.ts | 52 +++++------ src/server/editorServices.ts | 24 ++--- src/server/lsHost.ts | 2 +- src/server/project.ts | 44 ++++----- src/server/protocol.ts | 4 +- src/server/server.ts | 4 +- src/server/types.d.ts | 4 +- src/server/typingsCache.ts | 22 ++--- .../typingsInstaller/typingsInstaller.ts | 4 +- src/server/utilities.ts | 6 +- src/services/jsTyping.ts | 10 +-- src/services/shims.ts | 6 +- 19 files changed, 159 insertions(+), 159 deletions(-) rename src/harness/unittests/{convertTypingOptionsFromJson.ts => convertTypeAcquisitionFromJson.ts} (63%) diff --git a/Jakefile.js b/Jakefile.js index 087bbb67511..dcdebdf8ea5 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -256,7 +256,7 @@ var harnessSources = harnessCoreSources.concat([ "commandLineParsing.ts", "configurationExtension.ts", "convertCompilerOptionsFromJson.ts", - "convertTypingOptionsFromJson.ts", + "convertTypeAcquisitionFromJson.ts", "tsserverProjectSystem.ts", "compileOnSave.ts", "typingsInstaller.ts", diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 26877de43c4..d54af31a985 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -462,9 +462,9 @@ namespace ts { ]; /* @internal */ - export let typingOptionDeclarations: CommandLineOption[] = [ + export let typeAcquisitionDeclarations: CommandLineOption[] = [ { - name: "enableAutoDiscovery", + name: "enable", type: "boolean", }, { @@ -835,7 +835,7 @@ namespace ts { return { options: {}, fileNames: [], - typingOptions: {}, + typeAcquisition: {}, raw: json, errors: [createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> "))], wildcardDirectories: {} @@ -843,7 +843,7 @@ namespace ts { } let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + const typeAcquisition: TypeAcquisition = convertTypeAcquisitionFromJsonWorker(json["typeAcquisition"], basePath, errors, configFileName); if (json["extends"]) { let [include, exclude, files, baseOptions]: [string[], string[], string[], CompilerOptions] = [undefined, undefined, undefined, {}]; @@ -874,7 +874,7 @@ namespace ts { return { options, fileNames, - typingOptions, + typeAcquisition, raw: json, errors, wildcardDirectories, @@ -996,9 +996,9 @@ namespace ts { return { options, errors }; } - export function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: TypingOptions, errors: Diagnostic[] } { + export function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: TypeAcquisition, errors: Diagnostic[] } { const errors: Diagnostic[] = []; - const options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + const options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options, errors }; } @@ -1012,16 +1012,16 @@ namespace ts { return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions: any, - basePath: string, errors: Diagnostic[], configFileName?: string): TypingOptions { + function convertTypeAcquisitionFromJsonWorker(jsonOptions: any, + basePath: string, errors: Diagnostic[], configFileName?: string): TypeAcquisition { - const options: TypingOptions = { enableAutoDiscovery: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - convertOptionsFromJson(typingOptionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_typing_option_0, errors); + const options: TypeAcquisition = { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + convertOptionsFromJson(typeAcquisitionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } function convertOptionsFromJson(optionDeclarations: CommandLineOption[], jsonOptions: any, basePath: string, - defaultOptions: CompilerOptions | TypingOptions, diagnosticMessage: DiagnosticMessage, errors: Diagnostic[]) { + defaultOptions: CompilerOptions | TypeAcquisition, diagnosticMessage: DiagnosticMessage, errors: Diagnostic[]) { if (!jsonOptions) { return; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7f12558cee5..b823b1ed6b3 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3137,7 +3137,7 @@ "category": "Error", "code": 17009 }, - "Unknown typing option '{0}'.": { + "Unknown type acquisition option '{0}'.": { "category": "Error", "code": 17010 }, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2b8b6fe294e..5cd5b15d653 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3198,8 +3198,8 @@ namespace ts { [option: string]: CompilerOptionsValue | undefined; } - export interface TypingOptions { - enableAutoDiscovery?: boolean; + export interface TypeAcquisition { + enable?: boolean; include?: string[]; exclude?: string[]; [option: string]: string[] | boolean | undefined; @@ -3210,7 +3210,7 @@ namespace ts { projectRootPath: string; // The path to the project root directory safeListPath: string; // The path used to retrieve the safe list packageNameToTypingLocation: Map; // The map of package names to their cached typing locations - typingOptions: TypingOptions; // Used to customize the typing inference process + typeAcquisition: TypeAcquisition; // Used to customize the type acquisition process compilerOptions: CompilerOptions; // Used as a source for typing inference unresolvedImports: ReadonlyArray; // List of unresolved module ids from imports } @@ -3275,7 +3275,7 @@ namespace ts { /** Either a parsed command line or a parsed tsconfig.json */ export interface ParsedCommandLine { options: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; fileNames: string[]; raw?: any; errors: Diagnostic[]; diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index d3a814f26ca..f4057057e4e 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -108,7 +108,7 @@ "./unittests/commandLineParsing.ts", "./unittests/configurationExtension.ts", "./unittests/convertCompilerOptionsFromJson.ts", - "./unittests/convertTypingOptionsFromJson.ts", + "./unittests/convertTypeAcquisitionFromJson.ts", "./unittests/tsserverProjectSystem.ts", "./unittests/matchFiles.ts", "./unittests/initializeTSConfig.ts", diff --git a/src/harness/unittests/convertTypingOptionsFromJson.ts b/src/harness/unittests/convertTypeAcquisitionFromJson.ts similarity index 63% rename from src/harness/unittests/convertTypingOptionsFromJson.ts rename to src/harness/unittests/convertTypeAcquisitionFromJson.ts index 439409b24b7..a935c3c0e66 100644 --- a/src/harness/unittests/convertTypingOptionsFromJson.ts +++ b/src/harness/unittests/convertTypeAcquisitionFromJson.ts @@ -2,12 +2,12 @@ /// namespace ts { - describe("convertTypingOptionsFromJson", () => { - function assertTypingOptions(json: any, configFileName: string, expectedResult: { typingOptions: TypingOptions, errors: Diagnostic[] }) { - const { options: actualTypingOptions, errors: actualErrors } = convertTypingOptionsFromJson(json["typingOptions"], "/apath/", configFileName); - const parsedTypingOptions = JSON.stringify(actualTypingOptions); - const expectedTypingOptions = JSON.stringify(expectedResult.typingOptions); - assert.equal(parsedTypingOptions, expectedTypingOptions); + describe("convertTypeAcquisitionFromJson", () => { + function assertTypeAcquisition(json: any, configFileName: string, expectedResult: { typeAcquisition: TypeAcquisition, errors: Diagnostic[] }) { + const { options: actualTypeAcquisition, errors: actualErrors } = convertTypeAcquisitionFromJson(json["typeAcquisition"], "/apath/", configFileName); + const parsedTypeAcquisition = JSON.stringify(actualTypeAcquisition); + const expectedTypeAcquisition = JSON.stringify(expectedResult.typeAcquisition); + assert.equal(parsedTypeAcquisition, expectedTypeAcquisition); const expectedErrors = expectedResult.errors; assert.isTrue(expectedResult.errors.length === actualErrors.length, `Expected error: ${JSON.stringify(expectedResult.errors)}. Actual error: ${JSON.stringify(actualErrors)}.`); @@ -21,20 +21,20 @@ namespace ts { // tsconfig.json it("Convert correctly format tsconfig.json to typing-options ", () => { - assertTypingOptions( + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { - "enableAutoDiscovery": true, + "enable": true, "include": ["0.d.ts", "1.d.ts"], "exclude": ["0.js", "1.js"] } }, "tsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: true, + enable: true, include: ["0.d.ts", "1.d.ts"], exclude: ["0.js", "1.js"] }, @@ -43,24 +43,24 @@ namespace ts { }); it("Convert incorrect format tsconfig.json to typing-options ", () => { - assertTypingOptions( + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { "enableAutoDiscovy": true, } }, "tsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: false, + enable: false, include: [], exclude: [] }, errors: [ { - category: Diagnostics.Unknown_typing_option_0.category, - code: Diagnostics.Unknown_typing_option_0.code, + category: Diagnostics.Unknown_type_acquisition_option_0.category, + code: Diagnostics.Unknown_type_acquisition_option_0.code, file: undefined, start: 0, length: 0, @@ -71,11 +71,11 @@ namespace ts { }); it("Convert default tsconfig.json to typing-options ", () => { - assertTypingOptions({}, "tsconfig.json", + assertTypeAcquisition({}, "tsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: false, + enable: false, include: [], exclude: [] }, @@ -83,18 +83,18 @@ namespace ts { }); }); - it("Convert tsconfig.json with only enableAutoDiscovery property to typing-options ", () => { - assertTypingOptions( + it("Convert tsconfig.json with only enable property to typing-options ", () => { + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { - "enableAutoDiscovery": true + "enable": true } }, "tsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: true, + enable: true, include: [], exclude: [] }, @@ -104,19 +104,19 @@ namespace ts { // jsconfig.json it("Convert jsconfig.json to typing-options ", () => { - assertTypingOptions( + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { - "enableAutoDiscovery": false, + "enable": false, "include": ["0.d.ts"], "exclude": ["0.js"] } }, "jsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: false, + enable: false, include: ["0.d.ts"], exclude: ["0.js"] }, @@ -125,11 +125,11 @@ namespace ts { }); it("Convert default jsconfig.json to typing-options ", () => { - assertTypingOptions({ }, "jsconfig.json", + assertTypeAcquisition({ }, "jsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: true, + enable: true, include: [], exclude: [] }, @@ -138,24 +138,24 @@ namespace ts { }); it("Convert incorrect format jsconfig.json to typing-options ", () => { - assertTypingOptions( + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { "enableAutoDiscovy": true, } }, "jsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: true, + enable: true, include: [], exclude: [] }, errors: [ { category: Diagnostics.Unknown_compiler_option_0.category, - code: Diagnostics.Unknown_typing_option_0.code, + code: Diagnostics.Unknown_type_acquisition_option_0.code, file: undefined, start: 0, length: 0, @@ -165,18 +165,18 @@ namespace ts { }); }); - it("Convert jsconfig.json with only enableAutoDiscovery property to typing-options ", () => { - assertTypingOptions( + it("Convert jsconfig.json with only enable property to typing-options ", () => { + assertTypeAcquisition( { - "typingOptions": + "typeAcquisition": { - "enableAutoDiscovery": false + "enable": false } }, "jsconfig.json", { - typingOptions: + typeAcquisition: { - enableAutoDiscovery: false, + enable: false, include: [], exclude: [] }, diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index e9b6ccb7884..7aed5f81908 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -90,8 +90,8 @@ namespace ts.projectSystem { this.projectService.updateTypingsForProject(response); } - enqueueInstallTypingsRequest(project: server.Project, typingOptions: TypingOptions, unresolvedImports: server.SortedReadonlyArray) { - const request = server.createInstallTypingsRequest(project, typingOptions, unresolvedImports, this.globalTypingsCacheLocation); + enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: server.SortedReadonlyArray) { + const request = server.createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, this.globalTypingsCacheLocation); this.install(request); } @@ -1726,8 +1726,8 @@ namespace ts.projectSystem { options: {} }); projectService.checkNumberOfProjects({ externalProjects: 1 }); - const typingOptions = projectService.externalProjects[0].getTypingOptions(); - assert.isTrue(typingOptions.enableAutoDiscovery, "Typing autodiscovery should be enabled"); + const typeAcquisition = projectService.externalProjects[0].getTypeAcquisition(); + assert.isTrue(typeAcquisition.enable, "Typine acquisition should be enabled"); }); }); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 2dda506ad58..aea9f4eb9ed 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -57,8 +57,8 @@ namespace ts.projectSystem { compilerOptions: { allowJs: true }, - typingOptions: { - enableAutoDiscovery: true + typeAcquisition: { + enable: true } }) }; @@ -145,7 +145,7 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path, jquery.path]); }); - it("external project - no typing options, no .d.ts/js files", () => { + it("external project - no type acquisition, no .d.ts/js files", () => { const file1 = { path: "/a/b/app.ts", content: "" @@ -173,7 +173,7 @@ namespace ts.projectSystem { projectService.checkNumberOfProjects({ externalProjects: 1 }); }); - it("external project - no autoDiscovery in typing options, no .d.ts/js files", () => { + it("external project - no auto in typing acquisition, no .d.ts/js files", () => { const file1 = { path: "/a/b/app.ts", content: "" @@ -194,11 +194,11 @@ namespace ts.projectSystem { projectFileName, options: {}, rootFiles: [toExternalFile(file1.path)], - typingOptions: { include: ["jquery"] } + typeAcquisition: { include: ["jquery"] } }); installer.checkPendingCommands(/*expectedCount*/ 0); // by default auto discovery will kick in if project contain only .js/.d.ts files - // in this case project contain only ts files - no auto discovery even if typing options is set + // in this case project contain only ts files - no auto discovery even if type acquisition is set projectService.checkNumberOfProjects({ externalProjects: 1 }); }); @@ -217,9 +217,9 @@ namespace ts.projectSystem { constructor() { super(host, { typesRegistry: createTypesRegistry("jquery") }); } - enqueueInstallTypingsRequest(project: server.Project, typingOptions: TypingOptions, unresolvedImports: server.SortedReadonlyArray) { + enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: server.SortedReadonlyArray) { enqueueIsCalled = true; - super.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports); + super.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void { const installedTypings = ["@types/node"]; @@ -234,17 +234,17 @@ namespace ts.projectSystem { projectFileName, options: {}, rootFiles: [toExternalFile(file1.path)], - typingOptions: { enableAutoDiscovery: true, include: ["jquery"] } + typeAcquisition: { enable: true, include: ["jquery"] } }); assert.isTrue(enqueueIsCalled, "expected enqueueIsCalled to be true"); installer.installAll(/*expectedCount*/ 1); - // autoDiscovery is set in typing options - use it even if project contains only .ts files + // auto is set in type acquisition - use it even if project contains only .ts files projectService.checkNumberOfProjects({ externalProjects: 1 }); }); - it("external project - no typing options, with only js, jsx, d.ts files", () => { + it("external project - no type acquisition, with only js, jsx, d.ts files", () => { // Tests: // 1. react typings are installed for .jsx // 2. loose files names are matched against safe list for typings if @@ -288,7 +288,7 @@ namespace ts.projectSystem { projectFileName, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(file1.path), toExternalFile(file2.path), toExternalFile(file3.path)], - typingOptions: {} + typeAcquisition: {} }); const p = projectService.externalProjects[0]; @@ -301,7 +301,7 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path, file2.path, file3.path, lodash.path, react.path]); }); - it("external project - no typing options, with js & ts files", () => { + it("external project - no type acquisition, with js & ts files", () => { // Tests: // 1. No typings are included for JS projects when the project contains ts files const file1 = { @@ -319,9 +319,9 @@ namespace ts.projectSystem { constructor() { super(host, { typesRegistry: createTypesRegistry("jquery") }); } - enqueueInstallTypingsRequest(project: server.Project, typingOptions: TypingOptions, unresolvedImports: server.SortedReadonlyArray) { + enqueueInstallTypingsRequest(project: server.Project, typeAcquisition: TypeAcquisition, unresolvedImports: server.SortedReadonlyArray) { enqueueIsCalled = true; - super.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports); + super.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction): void { const installedTypings: string[] = []; @@ -336,7 +336,7 @@ namespace ts.projectSystem { projectFileName, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(file1.path), toExternalFile(file2.path)], - typingOptions: {} + typeAcquisition: {} }); const p = projectService.externalProjects[0]; @@ -349,11 +349,11 @@ namespace ts.projectSystem { checkProjectActualFiles(p, [file1.path, file2.path]); }); - it("external project - with typing options, with only js, d.ts files", () => { + it("external project - with type acquisition, with only js, d.ts files", () => { // Tests: - // 1. Safelist matching, typing options includes/excludes and package.json typings are all acquired - // 2. Types for safelist matches are not included when they also appear in the typing option exclude list - // 3. Multiple includes and excludes are respected in typing options + // 1. Safelist matching, type acquisition includes/excludes and package.json typings are all acquired + // 2. Types for safelist matches are not included when they also appear in the type acquisition exclude list + // 3. Multiple includes and excludes are respected in type acquisition const file1 = { path: "/a/b/lodash.js", content: "" @@ -411,7 +411,7 @@ namespace ts.projectSystem { projectFileName, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(file1.path), toExternalFile(file2.path), toExternalFile(file3.path)], - typingOptions: { include: ["jquery", "moment"], exclude: ["lodash"] } + typeAcquisition: { include: ["jquery", "moment"], exclude: ["lodash"] } }); const p = projectService.externalProjects[0]; @@ -486,7 +486,7 @@ namespace ts.projectSystem { projectFileName, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(lodashJs.path), toExternalFile(commanderJs.path), toExternalFile(file3.path)], - typingOptions: { include: ["jquery", "moment"] } + typeAcquisition: { include: ["jquery", "moment"] } }); const p = projectService.externalProjects[0]; @@ -572,7 +572,7 @@ namespace ts.projectSystem { projectFileName: projectFileName1, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(lodashJs.path), toExternalFile(commanderJs.path), toExternalFile(file3.path)], - typingOptions: { include: ["jquery", "cordova"] } + typeAcquisition: { include: ["jquery", "cordova"] } }); installer.checkPendingCommands(/*expectedCount*/ 1); @@ -584,7 +584,7 @@ namespace ts.projectSystem { projectFileName: projectFileName2, options: { allowJS: true, moduleResolution: ModuleResolutionKind.NodeJs }, rootFiles: [toExternalFile(file3.path)], - typingOptions: { include: ["grunt", "gulp"] } + typeAcquisition: { include: ["grunt", "gulp"] } }); assert.equal(installer.pendingRunRequests.length, 1, "expect one throttled request"); @@ -930,7 +930,7 @@ namespace ts.projectSystem { const host = createServerHost([f]); const cache = createMap(); for (const name of JsTyping.nodeCoreModuleList) { - const result = JsTyping.discoverTypings(host, [f.path], getDirectoryPath(f.path), /*safeListPath*/ undefined, cache, { enableAutoDiscovery: true }, [name, "somename"]); + const result = JsTyping.discoverTypings(host, [f.path], getDirectoryPath(f.path), /*safeListPath*/ undefined, cache, { enable: true }, [name, "somename"]); assert.deepEqual(result.newTypingNames.sort(), ["node", "somename"]); } }); @@ -946,7 +946,7 @@ namespace ts.projectSystem { }; const host = createServerHost([f, node]); const cache = createMap({ "node": node.path }); - const result = JsTyping.discoverTypings(host, [f.path], getDirectoryPath(f.path), /*safeListPath*/ undefined, cache, { enableAutoDiscovery: true }, ["fs", "bar"]); + const result = JsTyping.discoverTypings(host, [f.path], getDirectoryPath(f.path), /*safeListPath*/ undefined, cache, { enable: true }, ["fs", "bar"]); assert.deepEqual(result.cachedTypingPaths, [node.path]); assert.deepEqual(result.newTypingNames, ["bar"]); }); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6a7cb049296..49111d4a67f 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -317,7 +317,7 @@ namespace ts.server { } switch (response.kind) { case 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 ActionInvalidate: this.typingsCache.deleteTypingsForProject(response.projectName); @@ -821,7 +821,7 @@ namespace ts.server { compilerOptions: parsedCommandLine.options, configHasFilesProperty: config["files"] !== undefined, wildcardDirectories: createMap(parsedCommandLine.wildcardDirectories), - typingOptions: parsedCommandLine.typingOptions, + typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave }; return { success: true, projectOptions, configFileErrors: errors }; @@ -845,7 +845,7 @@ namespace ts.server { return false; } - private createAndAddExternalProject(projectFileName: string, files: protocol.ExternalFile[], options: protocol.ExternalProjectCompilerOptions, typingOptions: TypingOptions) { + private createAndAddExternalProject(projectFileName: string, files: protocol.ExternalFile[], options: protocol.ExternalProjectCompilerOptions, typeAcquisition: TypeAcquisition) { const compilerOptions = convertCompilerOptions(options); const project = new ExternalProject( projectFileName, @@ -855,7 +855,7 @@ namespace ts.server { /*languageServiceEnabled*/ !this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave); - this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, /*clientFileName*/ undefined, typingOptions, /*configFileErrors*/ undefined); + this.addFilesToProjectAndUpdateGraph(project, files, externalFilePropertyReader, /*clientFileName*/ undefined, typeAcquisition, /*configFileErrors*/ undefined); this.externalProjects.push(project); return project; } @@ -883,7 +883,7 @@ namespace ts.server { /*languageServiceEnabled*/ !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(project => this.onConfigChangedForConfiguredProject(project)); if (!sizeLimitExceeded) { @@ -902,7 +902,7 @@ namespace ts.server { } } - private addFilesToProjectAndUpdateGraph(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader, clientFileName: string, typingOptions: TypingOptions, configFileErrors: Diagnostic[]): void { + private addFilesToProjectAndUpdateGraph(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader, clientFileName: string, typeAcquisition: TypeAcquisition, configFileErrors: Diagnostic[]): void { let errors: Diagnostic[]; for (const f of files) { const rootFilename = propertyReader.getFileName(f); @@ -917,7 +917,7 @@ namespace ts.server { } } project.setProjectErrors(concatenate(configFileErrors, errors)); - project.setTypingOptions(typingOptions); + project.setTypeAcquisition(typeAcquisition); project.updateGraph(); } @@ -934,7 +934,7 @@ namespace ts.server { }; } - private updateNonInferredProject(project: ExternalProject | ConfiguredProject, newUncheckedFiles: T[], propertyReader: FilePropertyReader, newOptions: CompilerOptions, newTypingOptions: TypingOptions, compileOnSave: boolean, configFileErrors: Diagnostic[]) { + private updateNonInferredProject(project: ExternalProject | ConfiguredProject, newUncheckedFiles: T[], propertyReader: FilePropertyReader, newOptions: CompilerOptions, newTypeAcquisition: TypeAcquisition, compileOnSave: boolean, configFileErrors: Diagnostic[]) { const oldRootScriptInfos = project.getRootScriptInfos(); const newRootScriptInfos: ScriptInfo[] = []; const newRootScriptInfoMap: NormalizedPathMap = createNormalizedPathMap(); @@ -996,7 +996,7 @@ namespace ts.server { } project.setCompilerOptions(newOptions); - (project).setTypingOptions(newTypingOptions); + (project).setTypeAcquisition(newTypeAcquisition); // VS only set the CompileOnSaveEnabled option in the request if the option was changed recently // therefore if it is undefined, it should not be updated. @@ -1036,7 +1036,7 @@ namespace ts.server { 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); } } @@ -1340,7 +1340,7 @@ namespace ts.server { if (externalProject) { if (!tsConfigFiles) { // 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.typingOptions, proj.options.compileOnSave, /*configFileErrors*/ undefined); + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); return; } // some config files were added to external project (that previously were not there) @@ -1400,7 +1400,7 @@ namespace ts.server { else { // no config files - remove the item from the collection delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; - this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typingOptions); + this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } this.refreshInferredProjects(); } diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index 8f57cbf4074..aa37008ff66 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -23,7 +23,7 @@ namespace ts.server { } this.resolveModuleName = (moduleName, containingFile, compilerOptions, host) => { - const globalCache = this.project.getTypingOptions().enableAutoDiscovery + const globalCache = this.project.getTypeAcquisition().enable ? this.project.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host); diff --git a/src/server/project.ts b/src/server/project.ts index 82ecc6f3644..c37dd6e135a 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -312,7 +312,7 @@ namespace ts.server { return this.projectName; } abstract getProjectRootPath(): string | undefined; - abstract getTypingOptions(): TypingOptions; + abstract getTypeAcquisition(): TypeAcquisition; getSourceFile(path: Path) { if (!this.program) { @@ -802,9 +802,9 @@ namespace ts.server { } } - getTypingOptions(): TypingOptions { + getTypeAcquisition(): TypeAcquisition { return { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; @@ -812,7 +812,7 @@ namespace ts.server { } export class ConfiguredProject extends Project { - private typingOptions: TypingOptions; + private typeAcquisition: TypeAcquisition; private projectFileWatcher: FileWatcher; private directoryWatcher: FileWatcher; private directoriesWatchedForWildcards: Map; @@ -844,12 +844,12 @@ namespace ts.server { this.projectErrors = projectErrors; } - setTypingOptions(newTypingOptions: TypingOptions): void { - this.typingOptions = newTypingOptions; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void { + this.typeAcquisition = newTypeAcquisition; } - getTypingOptions() { - return this.typingOptions; + getTypeAcquisition() { + return this.typeAcquisition; } watchConfigFile(callback: (project: ConfiguredProject) => void) { @@ -939,7 +939,7 @@ namespace ts.server { } export class ExternalProject extends Project { - private typingOptions: TypingOptions; + private typeAcquisition: TypeAcquisition; constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, @@ -960,36 +960,36 @@ namespace ts.server { return getDirectoryPath(normalizeSlashes(this.getProjectName())); } - getTypingOptions() { - return this.typingOptions; + getTypeAcquisition() { + return this.typeAcquisition; } setProjectErrors(projectErrors: Diagnostic[]) { this.projectErrors = projectErrors; } - setTypingOptions(newTypingOptions: TypingOptions): void { - if (!newTypingOptions) { + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void { + if (!newTypeAcquisition) { // set default typings options - newTypingOptions = { - enableAutoDiscovery: allRootFilesAreJsOrDts(this), + newTypeAcquisition = { + enable: allRootFilesAreJsOrDts(this), include: [], exclude: [] }; } else { - if (newTypingOptions.enableAutoDiscovery === undefined) { + if (newTypeAcquisition.enable === undefined) { // if autoDiscovery was not specified by the caller - set it based on the content of the project - newTypingOptions.enableAutoDiscovery = allRootFilesAreJsOrDts(this); + 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; + this.typeAcquisition = newTypeAcquisition; } } } \ No newline at end of file diff --git a/src/server/protocol.ts b/src/server/protocol.ts index dad66f3cc71..f25ed190c08 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -861,9 +861,9 @@ namespace ts.server.protocol { */ options: ExternalProjectCompilerOptions; /** - * Explicitly specified typing options for the project + * Explicitly specified type acquisition for the project */ - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; } export interface CompileOnSaveMixin { diff --git a/src/server/server.ts b/src/server/server.ts index 220b0d90c65..da928c57485 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -275,8 +275,8 @@ namespace ts.server { this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" }); } - enqueueInstallTypingsRequest(project: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray): void { - const request = createInstallTypingsRequest(project, typingOptions, unresolvedImports); + enqueueInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void { + const request = createInstallTypingsRequest(project, typeAcquisition, unresolvedImports); if (this.logger.hasLevel(LogLevel.verbose)) { if (this.logger.hasLevel(LogLevel.verbose)) { this.logger.info(`Scheduling throttled operation: ${JSON.stringify(request)}`); diff --git a/src/server/types.d.ts b/src/server/types.d.ts index a4032bf062e..77e9e762b59 100644 --- a/src/server/types.d.ts +++ b/src/server/types.d.ts @@ -31,7 +31,7 @@ declare namespace ts.server { readonly fileNames: string[]; readonly projectRootPath: ts.Path; readonly compilerOptions: ts.CompilerOptions; - readonly typingOptions: ts.TypingOptions; + readonly typeAcquisition: ts.TypeAcquisition; readonly unresolvedImports: SortedReadonlyArray; readonly cachePath?: string; readonly kind: "discover"; @@ -54,7 +54,7 @@ declare namespace ts.server { } export interface SetTypings extends ProjectResponse { - readonly typingOptions: ts.TypingOptions; + readonly typeAcquisition: ts.TypeAcquisition; readonly compilerOptions: ts.CompilerOptions; readonly typings: string[]; readonly unresolvedImports: SortedReadonlyArray; diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 9013622e24a..8b03d59003c 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -2,7 +2,7 @@ namespace ts.server { export 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; @@ -16,7 +16,7 @@ namespace ts.server { }; class TypingsCacheEntry { - readonly typingOptions: TypingOptions; + readonly typeAcquisition: TypeAcquisition; readonly compilerOptions: CompilerOptions; readonly typings: SortedReadonlyArray; readonly unresolvedImports: SortedReadonlyArray; @@ -52,8 +52,8 @@ namespace ts.server { return unique === 0; } - function typingOptionsChanged(opt1: TypingOptions, opt2: TypingOptions): boolean { - return opt1.enableAutoDiscovery !== opt2.enableAutoDiscovery || + function typeAcquisitionChanged(opt1: TypeAcquisition, opt2: TypeAcquisition): boolean { + return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude); } @@ -77,9 +77,9 @@ namespace ts.server { } getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray { - const typingOptions = project.getTypingOptions(); + const typeAcquisition = project.getTypeAcquisition(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return emptyArray; } @@ -87,28 +87,28 @@ namespace ts.server { const result: SortedReadonlyArray = entry ? entry.typings : emptyArray; if (forceRefresh || !entry || - typingOptionsChanged(typingOptions, entry.typingOptions) || + typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilerOptions(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { // Note: entry is now poisoned since it does not really contain typings for a given combination of compiler options\typings options. // instead it acts as a placeholder to prevent issuing multiple requests this.perProjectCache[project.getProjectName()] = { compilerOptions: project.getCompilerOptions(), - typingOptions, + typeAcquisition, typings: result, unresolvedImports, poisoned: true }; // something has been changed, issue a request to update typings - this.installer.enqueueInstallTypingsRequest(project, typingOptions, unresolvedImports); + this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } return result; } - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray, newTypings: string[]) { + updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]) { this.perProjectCache[projectName] = { compilerOptions, - typingOptions, + typeAcquisition, typings: toSortedReadonlyArray(newTypings), unresolvedImports, poisoned: false diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index 677e2c7bba0..25d53e14e75 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -150,7 +150,7 @@ namespace ts.server.typingsInstaller { req.projectRootPath, this.safeListPath, this.packageNameToTypingLocation, - req.typingOptions, + req.typeAcquisition, req.unresolvedImports); if (this.log.isEnabled()) { @@ -391,7 +391,7 @@ namespace ts.server.typingsInstaller { private createSetTypings(request: DiscoverTypings, typings: string[]): SetTypings { return { projectName: request.projectName, - typingOptions: request.typingOptions, + typeAcquisition: request.typeAcquisition, compilerOptions: request.compilerOptions, typings, unresolvedImports: request.unresolvedImports, diff --git a/src/server/utilities.ts b/src/server/utilities.ts index a52e5848de9..fd370da7fa1 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -46,12 +46,12 @@ namespace ts.server { } } - export function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings { + export function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings { return { projectName: project.getProjectName(), fileNames: project.getFileNames(/*excludeFilesFromExternalLibraries*/ true), compilerOptions: project.getCompilerOptions(), - typingOptions, + typeAcquisition, unresolvedImports, projectRootPath: getProjectRootPath(project), cachePath, @@ -171,7 +171,7 @@ namespace ts.server { files?: string[]; wildcardDirectories?: Map; compilerOptions?: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; compileOnSave?: boolean; } diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 316dcd355c2..04ac60c4e74 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -48,7 +48,7 @@ namespace ts.JsTyping { * @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 */ export function discoverTypings( @@ -57,14 +57,14 @@ namespace ts.JsTyping { projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, - typingOptions: TypingOptions, + typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray): { cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } { // A typing name to typing file path mapping const inferredTypings = createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { + if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } @@ -84,8 +84,8 @@ namespace ts.JsTyping { let searchDirs: string[] = []; let exclude: string[] = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; const possibleSearchDirs = map(fileNames, getDirectoryPath); if (projectRootPath) { diff --git a/src/services/shims.ts b/src/services/shims.ts index 1c8132793a3..6184f1e2ff3 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1138,7 +1138,7 @@ namespace ts { if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -1150,7 +1150,7 @@ namespace ts { return { options: configFile.options, - typingOptions: configFile.typingOptions, + typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, errors: realizeDiagnostics(configFile.errors, "\r\n") @@ -1175,7 +1175,7 @@ namespace ts { toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, - info.typingOptions, + info.typeAcquisition, info.unresolvedImports); }); } From eaf791e32841c815aecc26d98ad31564673a5695 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 18 Nov 2016 22:53:38 -0800 Subject: [PATCH 12/41] update to tslint@next --- scripts/parallel-lint.js | 22 +++++++++++-------- scripts/tslint/booleanTriviaRule.ts | 2 +- scripts/tslint/nextLineRule.ts | 2 +- scripts/tslint/noInOperatorRule.ts | 2 +- scripts/tslint/noIncrementDecrementRule.ts | 2 +- .../tslint/noTypeAssertionWhitespaceRule.ts | 2 +- .../objectLiteralSurroundingSpaceRule.ts | 2 +- scripts/tslint/preferConstRule.ts | 2 +- scripts/tslint/typeOperatorSpacingRule.ts | 2 +- 9 files changed, 21 insertions(+), 17 deletions(-) diff --git a/scripts/parallel-lint.js b/scripts/parallel-lint.js index a9aec06c2df..aec9960ce47 100644 --- a/scripts/parallel-lint.js +++ b/scripts/parallel-lint.js @@ -1,26 +1,29 @@ -var Linter = require("tslint"); +var tslint = require("tslint"); var fs = require("fs"); function getLinterOptions() { return { - configuration: require("../tslint.json"), formatter: "prose", formattersDirectory: undefined, rulesDirectory: "built/local/tslint" }; } - -function lintFileContents(options, path, contents) { - var ll = new Linter(path, contents, options); - return ll.lint(); +function getLinterConfiguration() { + return require("../tslint.json"); } -function lintFileAsync(options, path, cb) { +function lintFileContents(options, configuration, path, contents) { + var ll = new tslint.Linter(options); + ll.lint(path, contents, configuration); + return ll.getResult(); +} + +function lintFileAsync(options, configuration, path, cb) { fs.readFile(path, "utf8", function (err, contents) { if (err) { return cb(err); } - var result = lintFileContents(options, path, contents); + var result = lintFileContents(options, configuration, path, contents); cb(undefined, result); }); } @@ -30,7 +33,8 @@ process.on("message", function (data) { case "file": var target = data.name; var lintOptions = getLinterOptions(); - lintFileAsync(lintOptions, target, function (err, result) { + var lintConfiguration = getLinterConfiguration(); + lintFileAsync(lintOptions, lintConfiguration, target, function (err, result) { if (err) { process.send({ kind: "error", error: err.toString() }); return; diff --git a/scripts/tslint/booleanTriviaRule.ts b/scripts/tslint/booleanTriviaRule.ts index b626b7560a6..db6abcbf17b 100644 --- a/scripts/tslint/booleanTriviaRule.ts +++ b/scripts/tslint/booleanTriviaRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; export class Rule extends Lint.Rules.AbstractRule { diff --git a/scripts/tslint/nextLineRule.ts b/scripts/tslint/nextLineRule.ts index d25652f7bce..2dee393bd84 100644 --- a/scripts/tslint/nextLineRule.ts +++ b/scripts/tslint/nextLineRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; const OPTION_CATCH = "check-catch"; diff --git a/scripts/tslint/noInOperatorRule.ts b/scripts/tslint/noInOperatorRule.ts index 527e8c1b895..307f0dffd6a 100644 --- a/scripts/tslint/noInOperatorRule.ts +++ b/scripts/tslint/noInOperatorRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; diff --git a/scripts/tslint/noIncrementDecrementRule.ts b/scripts/tslint/noIncrementDecrementRule.ts index f5c90abe893..2a957b36af5 100644 --- a/scripts/tslint/noIncrementDecrementRule.ts +++ b/scripts/tslint/noIncrementDecrementRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; diff --git a/scripts/tslint/noTypeAssertionWhitespaceRule.ts b/scripts/tslint/noTypeAssertionWhitespaceRule.ts index e75964b9e7e..5368dcf74ba 100644 --- a/scripts/tslint/noTypeAssertionWhitespaceRule.ts +++ b/scripts/tslint/noTypeAssertionWhitespaceRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; diff --git a/scripts/tslint/objectLiteralSurroundingSpaceRule.ts b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts index b527746bf51..a705e56c969 100644 --- a/scripts/tslint/objectLiteralSurroundingSpaceRule.ts +++ b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; diff --git a/scripts/tslint/preferConstRule.ts b/scripts/tslint/preferConstRule.ts index 445fbe2e72a..28d7446b290 100644 --- a/scripts/tslint/preferConstRule.ts +++ b/scripts/tslint/preferConstRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; export class Rule extends Lint.Rules.AbstractRule { diff --git a/scripts/tslint/typeOperatorSpacingRule.ts b/scripts/tslint/typeOperatorSpacingRule.ts index 559d1b34937..50f2971a0ee 100644 --- a/scripts/tslint/typeOperatorSpacingRule.ts +++ b/scripts/tslint/typeOperatorSpacingRule.ts @@ -1,4 +1,4 @@ -import * as Lint from "tslint/lib/lint"; +import * as Lint from "tslint/lib"; import * as ts from "typescript"; From c96bc89982d2d6f98f6d258a90bca66950222978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Parditka?= Date: Sat, 19 Nov 2016 11:13:36 +0100 Subject: [PATCH 13/41] Fix issue #12260. Fixed tsserver crashing on Android (Termux). --- src/server/server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/server.ts b/src/server/server.ts index 220b0d90c65..afe0382084c 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -31,6 +31,7 @@ namespace ts.server { 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}`) || @@ -598,4 +599,4 @@ namespace ts.server { (process as any).noAsar = true; // Start listening ioSession.listen(); -} \ No newline at end of file +} From dcd225a8923bbb6fc4f168d41e7ab644bf8ce481 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 19 Nov 2016 09:03:23 -0800 Subject: [PATCH 14/41] Fix comparable relation for keyof T Treat keyof T as string | number for purposes of indexing Allow indexed access types with for-in and in operator --- src/compiler/checker.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 024c3d4a983..ccd731e7a2c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6037,11 +6037,12 @@ namespace ts { const id = objectType.id + "," + indexType.id; return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); } - const apparentType = getApparentType(objectType); - if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) { + const apparentObjectType = getApparentType(objectType); + const apparentIndexType = indexType.flags & TypeFlags.Index ? stringOrNumberType : indexType; + if (apparentIndexType.flags & TypeFlags.Union && !(apparentIndexType.flags & TypeFlags.Primitive)) { const propTypes: Type[] = []; - for (const t of (indexType).types) { - const propType = getPropertyTypeForIndexType(apparentType, t, accessNode, /*cacheSymbol*/ false); + for (const t of (apparentIndexType).types) { + const propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false); if (propType === unknownType) { return unknownType; } @@ -6049,7 +6050,7 @@ namespace ts { } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentType, indexType, accessNode, /*cacheSymbol*/ true); + return getPropertyTypeForIndexType(apparentObjectType, apparentIndexType, accessNode, /*cacheSymbol*/ true); } function getTypeFromIndexedAccessTypeNode(node: IndexedAccessTypeNode) { @@ -7123,7 +7124,10 @@ namespace ts { if (source.flags & TypeFlags.Index) { // A keyof T is related to a union type containing both string and number - if (maybeTypeOfKind(target, TypeFlags.String) && maybeTypeOfKind(target, TypeFlags.Number)) { + const related = relation === comparableRelation ? + maybeTypeOfKind(target, TypeFlags.String | TypeFlags.Number) : + maybeTypeOfKind(target, TypeFlags.String) && maybeTypeOfKind(target, TypeFlags.Number); + if (related) { return Ternary.True; } } @@ -14254,7 +14258,7 @@ namespace ts { if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, TypeFlags.StringLike | 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)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { 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; @@ -17148,7 +17152,7 @@ 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)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { 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); } From a439e6213883a310bbeefb7cac7777f4cff6f04c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 19 Nov 2016 15:10:22 -0800 Subject: [PATCH 15/41] Add tests --- .../types/keyof/keyofAndIndexedAccess.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 1e874aaf80f..522bfe34e15 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -181,6 +181,46 @@ function f40(c: C) { let z: Z = c["z"]; } +function f50(k: keyof T, s: string, n: number) { + const x1 = s as keyof T; + const x2 = n as keyof T; + const x3 = k as string; + const x4 = k as number; + const x5 = k as string | number; +} + +function f51(k: K, s: string, n: number) { + const x1 = s as keyof T; + const x2 = n as keyof T; + const x3 = k as string; + const x4 = k as number; + const x5 = k as string | number; +} + +function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { + const x1 = obj[s]; + const x2 = obj[n]; + const x3 = obj[k]; +} + +function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { + const x1 = obj[s]; + const x2 = obj[n]; + const x3 = obj[k]; +} + +function f54(obj: T, key: keyof T) { + for (let s in obj[key]) { + } + const b = "foo" in obj[key]; +} + +function f55(obj: T, key: K) { + for (let s in obj[key]) { + } + const b = "foo" in obj[key]; +} + // Repros from #12011 class Base { From 4ce494a27d7727847eb94b508677ea981de8692c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 19 Nov 2016 15:10:35 -0800 Subject: [PATCH 16/41] Accept new baselines --- .../reference/keyofAndIndexedAccess.js | 84 +++++++ .../reference/keyofAndIndexedAccess.symbols | 230 +++++++++++++++--- .../reference/keyofAndIndexedAccess.types | 182 ++++++++++++++ 3 files changed, 460 insertions(+), 36 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index dd59a5a1b4c..eef81f4d5f7 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -181,6 +181,46 @@ function f40(c: C) { let z: Z = c["z"]; } +function f50(k: keyof T, s: string, n: number) { + const x1 = s as keyof T; + const x2 = n as keyof T; + const x3 = k as string; + const x4 = k as number; + const x5 = k as string | number; +} + +function f51(k: K, s: string, n: number) { + const x1 = s as keyof T; + const x2 = n as keyof T; + const x3 = k as string; + const x4 = k as number; + const x5 = k as string | number; +} + +function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { + const x1 = obj[s]; + const x2 = obj[n]; + const x3 = obj[k]; +} + +function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { + const x1 = obj[s]; + const x2 = obj[n]; + const x3 = obj[k]; +} + +function f54(obj: T, key: keyof T) { + for (let s in obj[key]) { + } + const b = "foo" in obj[key]; +} + +function f55(obj: T, key: K) { + for (let s in obj[key]) { + } + const b = "foo" in obj[key]; +} + // Repros from #12011 class Base { @@ -329,6 +369,40 @@ function f40(c) { var y = c["y"]; var z = c["z"]; } +function f50(k, s, n) { + var x1 = s; + var x2 = n; + var x3 = k; + var x4 = k; + var x5 = k; +} +function f51(k, s, n) { + var x1 = s; + var x2 = n; + var x3 = k; + var x4 = k; + var x5 = k; +} +function f52(obj, k, s, n) { + var x1 = obj[s]; + var x2 = obj[n]; + var x3 = obj[k]; +} +function f53(obj, k, s, n) { + var x1 = obj[s]; + var x2 = obj[n]; + var x3 = obj[k]; +} +function f54(obj, key) { + for (var s in obj[key]) { + } + var b = "foo" in obj[key]; +} +function f55(obj, key) { + for (var s in obj[key]) { + } + var b = "foo" in obj[key]; +} // Repros from #12011 var Base = (function () { function Base() { @@ -454,6 +528,16 @@ declare class C { private z; } declare function f40(c: C): void; +declare function f50(k: keyof T, s: string, n: number): void; +declare function f51(k: K, s: string, n: number): void; +declare function f52(obj: { + [x: string]: boolean; +}, k: keyof T, s: string, n: number): void; +declare function f53(obj: { + [x: string]: boolean; +}, k: K, s: string, n: number): void; +declare function f54(obj: T, key: keyof T): void; +declare function f55(obj: T, key: K): void; declare class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index a76cf32b8d2..0b10e368821 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -626,84 +626,242 @@ function f40(c: C) { >"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 167, 24)) } +function f50(k: keyof T, s: string, n: number) { +>f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 180, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38)) + + const x1 = s as keyof T; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 183, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) + + const x2 = n as keyof T; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 184, 9)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) + + const x3 = k as string; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 185, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) + + const x4 = k as number; +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 186, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) + + const x5 = k as string | number; +>x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 187, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) +} + +function f51(k: K, s: string, n: number) { +>f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 188, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51)) + + const x1 = s as keyof T; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 191, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) + + const x2 = n as keyof T; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 192, 9)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) + + const x3 = k as string; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 193, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) + + const x4 = k as number; +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 194, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) + + const x5 = k as string | number; +>x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 195, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) +} + +function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { +>f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 196, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 198, 24)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69)) + + const x1 = obj[s]; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 199, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58)) + + const x2 = obj[n]; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 200, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69)) + + const x3 = obj[k]; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 201, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46)) +} + +function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { +>f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 202, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 204, 43)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82)) + + const x1 = obj[s]; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 205, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71)) + + const x2 = obj[n]; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 206, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82)) + + const x3 = obj[k]; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 207, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65)) +} + +function f54(obj: T, key: keyof T) { +>f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 208, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) + + for (let s in obj[key]) { +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 211, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) + } + const b = "foo" in obj[key]; +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 213, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) +} + +function f55(obj: T, key: K) { +>f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 214, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15)) + + for (let s in obj[key]) { +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 217, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) + } + const b = "foo" in obj[key]; +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 219, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) +} + // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 185, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 185, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 188, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 188, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 188, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 188, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 188, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 193, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 233, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 195, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 180, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 187, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 195, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 198, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 238, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 191, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 184, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 204, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 244, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 206, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246, 16)) setProperty(this, "parts", parts); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 206, 16)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 208, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 248, 5)) return getProperty(this, "parts") >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 202, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index c252ea4e2bd..020ac114126 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -737,6 +737,188 @@ function f40(c: C) { >"z" : "z" } +function f50(k: keyof T, s: string, n: number) { +>f50 : (k: keyof T, s: string, n: number) => void +>T : T +>k : keyof T +>T : T +>s : string +>n : number + + const x1 = s as keyof T; +>x1 : keyof T +>s as keyof T : keyof T +>s : string +>T : T + + const x2 = n as keyof T; +>x2 : keyof T +>n as keyof T : keyof T +>n : number +>T : T + + const x3 = k as string; +>x3 : string +>k as string : string +>k : keyof T + + const x4 = k as number; +>x4 : number +>k as number : number +>k : keyof T + + const x5 = k as string | number; +>x5 : string | number +>k as string | number : string | number +>k : keyof T +} + +function f51(k: K, s: string, n: number) { +>f51 : (k: K, s: string, n: number) => void +>T : T +>K : K +>T : T +>k : K +>K : K +>s : string +>n : number + + const x1 = s as keyof T; +>x1 : keyof T +>s as keyof T : keyof T +>s : string +>T : T + + const x2 = n as keyof T; +>x2 : keyof T +>n as keyof T : keyof T +>n : number +>T : T + + const x3 = k as string; +>x3 : string +>k as string : string +>k : K + + const x4 = k as number; +>x4 : number +>k as number : number +>k : K + + const x5 = k as string | number; +>x5 : string | number +>k as string | number : string | number +>k : K +} + +function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { +>f52 : (obj: { [x: string]: boolean; }, k: keyof T, s: string, n: number) => void +>T : T +>obj : { [x: string]: boolean; } +>x : string +>k : keyof T +>T : T +>s : string +>n : number + + const x1 = obj[s]; +>x1 : boolean +>obj[s] : boolean +>obj : { [x: string]: boolean; } +>s : string + + const x2 = obj[n]; +>x2 : boolean +>obj[n] : boolean +>obj : { [x: string]: boolean; } +>n : number + + const x3 = obj[k]; +>x3 : boolean +>obj[k] : boolean +>obj : { [x: string]: boolean; } +>k : keyof T +} + +function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { +>f53 : (obj: { [x: string]: boolean; }, k: K, s: string, n: number) => void +>T : T +>K : K +>T : T +>obj : { [x: string]: boolean; } +>x : string +>k : K +>K : K +>s : string +>n : number + + const x1 = obj[s]; +>x1 : boolean +>obj[s] : boolean +>obj : { [x: string]: boolean; } +>s : string + + const x2 = obj[n]; +>x2 : boolean +>obj[n] : boolean +>obj : { [x: string]: boolean; } +>n : number + + const x3 = obj[k]; +>x3 : { [x: string]: boolean; }[K] +>obj[k] : { [x: string]: boolean; }[K] +>obj : { [x: string]: boolean; } +>k : K +} + +function f54(obj: T, key: keyof T) { +>f54 : (obj: T, key: keyof T) => void +>T : T +>obj : T +>T : T +>key : keyof T +>T : T + + for (let s in obj[key]) { +>s : string +>obj[key] : T[keyof T] +>obj : T +>key : keyof T + } + const b = "foo" in obj[key]; +>b : boolean +>"foo" in obj[key] : boolean +>"foo" : "foo" +>obj[key] : T[keyof T] +>obj : T +>key : keyof T +} + +function f55(obj: T, key: K) { +>f55 : (obj: T, key: K) => void +>T : T +>K : K +>T : T +>obj : T +>T : T +>key : K +>K : K + + for (let s in obj[key]) { +>s : string +>obj[key] : T[K] +>obj : T +>key : K + } + const b = "foo" in obj[key]; +>b : boolean +>"foo" in obj[key] : boolean +>"foo" : "foo" +>obj[key] : T[K] +>obj : T +>key : K +} + // Repros from #12011 class Base { From 4ed3225c06af34b5657d1a82f2f49f4b07b3a961 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 20 Nov 2016 08:13:39 -0800 Subject: [PATCH 17/41] Add optimized getTypeOfExpression function --- src/compiler/checker.ts | 62 ++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5f77f8952bb..68b1f7ef4d9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9000,7 +9000,7 @@ namespace ts { function getTypeWithDefault(type: Type, defaultExpression: Expression) { if (defaultExpression) { - const defaultType = checkExpression(defaultExpression); + const defaultType = getTypeOfExpression(defaultExpression); return getUnionType([getTypeWithFacts(type, TypeFacts.NEUndefined), defaultType]); } return type; @@ -9027,7 +9027,7 @@ namespace ts { function getAssignedTypeOfBinaryExpression(node: BinaryExpression): Type { return node.parent.kind === SyntaxKind.ArrayLiteralExpression || node.parent.kind === SyntaxKind.PropertyAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : - checkExpression(node.right); + getTypeOfExpression(node.right); } function getAssignedTypeOfArrayLiteralElement(node: ArrayLiteralExpression, element: Expression): Type { @@ -9085,7 +9085,7 @@ namespace ts { // from its initializer, we'll already have cached the type. Otherwise we compute it now // without caching such that transient types are reflected. const links = getNodeLinks(node); - return links.resolvedType || checkExpression(node); + return links.resolvedType || getTypeOfExpression(node); } function getInitialTypeOfVariableDeclaration(node: VariableDeclaration) { @@ -9145,7 +9145,7 @@ namespace ts { function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) { if (clause.kind === SyntaxKind.CaseClause) { - const caseType = getRegularTypeOfLiteralType(checkExpression((clause).expression)); + const caseType = getRegularTypeOfLiteralType(getTypeOfExpression((clause).expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -9250,7 +9250,7 @@ namespace ts { // we defer subtype reduction until the evolving array type is finalized into a manifest // array type. function addEvolvingArrayElementType(evolvingArrayType: EvolvingArrayType, node: Expression): EvolvingArrayType { - const elementType = getBaseTypeOfLiteralType(checkExpression(node)); + const elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } @@ -9311,7 +9311,7 @@ namespace ts { (parent.parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent.parent).left === parent && !isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(checkExpression((parent).argumentExpression), TypeFlags.NumberLike | TypeFlags.Undefined); + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression((parent).argumentExpression), TypeFlags.NumberLike | TypeFlags.Undefined); return isLengthPushOrUnshift || isElementAssignment; } @@ -9473,7 +9473,7 @@ namespace ts { } } else { - const indexType = checkExpression(((node).left).argumentExpression); + const indexType = getTypeOfExpression(((node).left).argumentExpression); if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, TypeFlags.NumberLike | TypeFlags.Undefined)) { evolvedType = addEvolvingArrayElementType(evolvedType, (node).right); } @@ -9698,7 +9698,7 @@ namespace ts { if (operator === SyntaxKind.ExclamationEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } - const valueType = checkExpression(value); + const valueType = getTypeOfExpression(value); if (valueType.flags & TypeFlags.Nullable) { if (!strictNullChecks) { return type; @@ -9785,7 +9785,7 @@ namespace ts { } // Check that right operand is a function type with a prototype property - const rightType = checkExpression(expr.right); + const rightType = getTypeOfExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } @@ -9926,7 +9926,7 @@ namespace ts { location = location.parent; } if (isPartOfExpression(location) && !isAssignmentTarget(location)) { - const type = checkExpression(location); + const type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -10794,7 +10794,7 @@ namespace 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 === SyntaxKind.BarBarToken) { @@ -10802,7 +10802,7 @@ namespace ts { // expression has no contextual type, the right operand is contextually typed by the type of the left operand. let type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { - type = checkExpression(binaryExpression.left); + type = getTypeOfExpression(binaryExpression.left); } return type; } @@ -12173,7 +12173,7 @@ namespace ts { if (node.kind === SyntaxKind.ForInStatement && child === (node).statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression((node).expression))) { + hasNumericPropertyNames(getTypeOfExpression((node).expression))) { return true; } child = node; @@ -13809,7 +13809,7 @@ namespace ts { if (!node.possiblyExhaustive) { return false; } - const type = checkExpression(node.expression); + const type = getTypeOfExpression(node.expression); if (!isLiteralType(type)) { return false; } @@ -14901,6 +14901,24 @@ namespace 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: Expression) { + // 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 === SyntaxKind.CallExpression && (node).expression.kind !== SyntaxKind.SuperKeyword) { + const funcType = checkNonNullExpression((node).expression); + const 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 @@ -18283,7 +18301,7 @@ namespace ts { } } - enumType = checkExpression(expression); + enumType = getTypeOfExpression(expression); // allow references to constant members of other enums if (!(enumType.symbol && (enumType.symbol.flags & SymbolFlags.Enum))) { return undefined; @@ -19453,7 +19471,7 @@ namespace ts { // fallthrough case SyntaxKind.SuperKeyword: - const type = isPartOfExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + const type = isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; case SyntaxKind.ThisType: @@ -19483,7 +19501,7 @@ namespace ts { case SyntaxKind.NumericLiteral: // index access if (node.parent.kind === SyntaxKind.ElementAccessExpression && (node.parent).argumentExpression === node) { - const objectType = checkExpression((node.parent).expression); + const objectType = getTypeOfExpression((node.parent).expression); if (objectType === unknownType) return undefined; const apparentType = getApparentType(objectType); if (apparentType === unknownType) return undefined; @@ -19522,7 +19540,7 @@ namespace ts { } if (isPartOfExpression(node)) { - return getTypeOfExpression(node); + return getRegularTypeOfExpression(node); } if (isExpressionWithTypeArgumentsInClassExtendsClause(node)) { @@ -19584,7 +19602,7 @@ namespace ts { // If this is from "for" initializer // for ({a } = elems[0];.....) { } if (expr.parent.kind === SyntaxKind.BinaryExpression) { - const iteratedType = checkExpression((expr.parent).right); + const iteratedType = getTypeOfExpression((expr.parent).right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern @@ -19614,11 +19632,11 @@ namespace ts { return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); } - function getTypeOfExpression(expr: Expression): Type { + function getRegularTypeOfExpression(expr: Expression): Type { if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { expr = expr.parent; } - return getRegularTypeOfLiteralType(checkExpression(expr)); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** @@ -20045,7 +20063,7 @@ namespace ts { } function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { - const type = getWidenedType(getTypeOfExpression(expr)); + const type = getWidenedType(getRegularTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } From d71c2dd03009549a393369a7328b17fe92b6f880 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 20 Nov 2016 08:55:09 -0800 Subject: [PATCH 18/41] Accept new baselines --- tests/baselines/reference/ambientRequireFunction.types | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselines/reference/ambientRequireFunction.types b/tests/baselines/reference/ambientRequireFunction.types index 7b01a59268f..e0341d97ec3 100644 --- a/tests/baselines/reference/ambientRequireFunction.types +++ b/tests/baselines/reference/ambientRequireFunction.types @@ -3,7 +3,7 @@ const fs = require("fs"); >fs : typeof "fs" ->require("fs") : typeof "fs" +>require("fs") : any >require : (moduleName: string) => any >"fs" : "fs" From c1c12c75f78c854edeb2309076e07ef950f71885 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 20 Nov 2016 08:55:20 -0800 Subject: [PATCH 19/41] Add regression test --- .../controlFlowSelfReferentialLoop.errors.txt | 188 ++++++++++++++++ .../controlFlowSelfReferentialLoop.js | 207 ++++++++++++++++++ .../controlFlowSelfReferentialLoop.ts | 102 +++++++++ 3 files changed, 497 insertions(+) create mode 100644 tests/baselines/reference/controlFlowSelfReferentialLoop.errors.txt create mode 100644 tests/baselines/reference/controlFlowSelfReferentialLoop.js create mode 100644 tests/cases/compiler/controlFlowSelfReferentialLoop.ts diff --git a/tests/baselines/reference/controlFlowSelfReferentialLoop.errors.txt b/tests/baselines/reference/controlFlowSelfReferentialLoop.errors.txt new file mode 100644 index 00000000000..deef6403761 --- /dev/null +++ b/tests/baselines/reference/controlFlowSelfReferentialLoop.errors.txt @@ -0,0 +1,188 @@ +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,19): error TS7006: Parameter 'b' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,21): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,23): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,27): error TS7006: Parameter 's' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(6,29): error TS7006: Parameter 'ac' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,19): error TS7006: Parameter 'b' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,21): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,23): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,27): error TS7006: Parameter 's' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(10,29): error TS7006: Parameter 'ac' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,19): error TS7006: Parameter 'b' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,21): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,23): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,27): error TS7006: Parameter 's' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(14,29): error TS7006: Parameter 'ac' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,17): error TS7006: Parameter 'a' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,19): error TS7006: Parameter 'b' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,21): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,23): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,25): error TS7006: Parameter 'x' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,27): error TS7006: Parameter 's' implicitly has an 'any' type. +tests/cases/compiler/controlFlowSelfReferentialLoop.ts(18,29): error TS7006: Parameter 'ac' implicitly has an 'any' type. + + +==== tests/cases/compiler/controlFlowSelfReferentialLoop.ts (28 errors) ==== + + // Repro from #12319 + + function md5(string:string): void { + + function FF(a,b,c,d,x,s,ac) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. + ~~ +!!! error TS7006: Parameter 'ac' implicitly has an 'any' type. + return 0; + }; + + function GG(a,b,c,d,x,s,ac) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. + ~~ +!!! error TS7006: Parameter 'ac' implicitly has an 'any' type. + return 0; + }; + + function HH(a,b,c,d,x,s,ac) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. + ~~ +!!! error TS7006: Parameter 'ac' implicitly has an 'any' type. + return 0; + }; + + function II(a,b,c,d,x,s,ac) { + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'x' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 's' implicitly has an 'any' type. + ~~ +!!! error TS7006: Parameter 'ac' implicitly has an 'any' type. + return 0; + }; + + var x=Array(); + var k,AA,BB,CC,DD,a,b,c,d; + var S11=7, S12=12, S13=17, S14=22; + var S21=5, S22=9 , S23=14, S24=20; + var S31=4, S32=11, S33=16, S34=23; + var S41=6, S42=10, S43=15, S44=21; + + x = [1]; + + a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; + + for (k=0;k Date: Mon, 21 Nov 2016 10:30:38 -0800 Subject: [PATCH 20/41] Add locale options to tsserver (#12369) * add locale options to tsserver * make sys an argument * fix mistakes and address code review --- src/compiler/tsc.ts | 62 +--------------------------- src/compiler/utilities.ts | 85 ++++++++++++++++++++++++++++++++++----- src/server/server.ts | 5 +++ 3 files changed, 82 insertions(+), 70 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 10d4a0c1d36..a7304eebe4b 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -43,66 +43,6 @@ namespace ts { } } - /** - * 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, errors: Diagnostic[]): boolean { - const matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); - - if (!matchResult) { - errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); - return false; - } - - const language = matchResult[1]; - const 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, undefined, errors); - } - - return true; - } - - function trySetLanguageAndTerritory(language: string, territory: string, errors: Diagnostic[]): boolean { - const compilerFilePath = normalizePath(sys.getExecutingFilePath()); - const containingDirectoryPath = getDirectoryPath(compilerFilePath); - - let filePath = combinePaths(containingDirectoryPath, language); - - if (territory) { - filePath = filePath + "-" + territory; - } - - filePath = sys.resolvePath(combinePaths(filePath, "diagnosticMessages.generated.json")); - - if (!sys.fileExists(filePath)) { - return false; - } - - // TODO: Add codePage support for readFile? - let fileContents = ""; - try { - fileContents = sys.readFile(filePath); - } - catch (e) { - errors.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath)); - return false; - } - try { - ts.localizedDiagnosticMessages = JSON.parse(fileContents); - } - catch (e) { - errors.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath)); - return false; - } - - return true; - } - function countLines(program: Program): number { let count = 0; forEach(program.getSourceFiles(), file => { @@ -263,7 +203,7 @@ namespace ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), /* host */ undefined); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); + validateLocaleAndSetLanguage(commandLine.options.locale, sys, commandLine.errors); } // If there are any errors due to command line parsing and/or diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 546416884f1..09318fbe41d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -472,15 +472,15 @@ namespace ts { export function getTextOfPropertyName(name: PropertyName): string { switch (name.kind) { - case SyntaxKind.Identifier: - return (name).text; - case SyntaxKind.StringLiteral: - case SyntaxKind.NumericLiteral: - return (name).text; - case SyntaxKind.ComputedPropertyName: - if (isStringOrNumericLiteral((name).expression)) { - return ((name).expression).text; - } + case SyntaxKind.Identifier: + return (name).text; + case SyntaxKind.StringLiteral: + case SyntaxKind.NumericLiteral: + return (name).text; + case SyntaxKind.ComputedPropertyName: + if (isStringOrNumericLiteral((name).expression)) { + return ((name).expression).text; + } } return undefined; @@ -4554,4 +4554,71 @@ namespace ts { return flags; } + + /** + * Checks to see if the locale is in the appropriate format, + * and if it is, attempts to set the appropriate language. + */ + export function validateLocaleAndSetLanguage( + locale: string, + sys: { getExecutingFilePath(): string, resolvePath(path: string): string, fileExists(fileName: string): boolean, readFile(fileName: string): string }, + errors?: Diagnostic[]) { + const matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); + + if (!matchResult) { + if (errors) { + errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); + } + return; + } + + const language = matchResult[1]; + const 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: string, territory: string, errors?: Diagnostic[]): boolean { + const compilerFilePath = normalizePath(sys.getExecutingFilePath()); + const containingDirectoryPath = getDirectoryPath(compilerFilePath); + + let filePath = combinePaths(containingDirectoryPath, language); + + if (territory) { + filePath = filePath + "-" + territory; + } + + filePath = sys.resolvePath(combinePaths(filePath, "diagnosticMessages.generated.json")); + + if (!sys.fileExists(filePath)) { + return false; + } + + // TODO: Add codePage support for readFile? + let fileContents = ""; + try { + fileContents = sys.readFile(filePath); + } + catch (e) { + if (errors) { + errors.push(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, filePath)); + } + return false; + } + try { + ts.localizedDiagnosticMessages = JSON.parse(fileContents); + } + catch (e) { + if (errors) { + errors.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath)); + } + return false; + } + + return true; + } + } } diff --git a/src/server/server.ts b/src/server/server.ts index afe0382084c..1d013c8c62a 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -578,6 +578,11 @@ namespace ts.server { } } + const localeStr = findArgument("--locale"); + if (localeStr) { + validateLocaleAndSetLanguage(localeStr, sys); + } + const useSingleInferredProject = hasArgument("--useSingleInferredProject"); const disableAutomaticTypingAcquisition = hasArgument("--disableAutomaticTypingAcquisition"); const telemetryEnabled = hasArgument(Arguments.EnableTelemetry); From 7c1f33f9136775646b45ffe0b8dae0657985abd0 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 21 Nov 2016 10:42:54 -0800 Subject: [PATCH 21/41] Fix lint errors --- src/services/codefixes/importFixes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 4adda19689d..bda310f2d33 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -52,7 +52,7 @@ namespace ts.codefix { // 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. + // but the new one is worse than the other one, so should not add to the list. updatedNewImports.push(existingAction); break; case ModuleSpecifierComparison.Worse: @@ -145,7 +145,7 @@ namespace ts.codefix { if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { // check if this symbol is already used const symbolId = getUniqueSymbolId(localSymbol); - symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefaultExport*/ true)); + symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true)); } } @@ -483,7 +483,7 @@ namespace ts.codefix { const normalizedTypeRoots = map(typeRoots, typeRoot => toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName)); for (const typeRoot of normalizedTypeRoots) { if (startsWith(moduleFileName, typeRoot)) { - let relativeFileName = moduleFileName.substring(typeRoot.length + 1); + const relativeFileName = moduleFileName.substring(typeRoot.length + 1); return removeExtensionAndIndexPostFix(relativeFileName); } } From b060107b516b04c37081419770374a62b99c2bed Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 21 Nov 2016 11:34:09 -0800 Subject: [PATCH 22/41] recompute character to column when comparing indentations (#12375) recompute character to column when comparing indentations --- src/services/formatting/formatting.ts | 15 ++++++++++++++- tests/cases/fourslash/formatWithTabs.ts | 16 ++++++++++++++++ tests/cases/fourslash/formatWithTabs2.ts | 16 ++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/formatWithTabs.ts create mode 100644 tests/cases/fourslash/formatWithTabs2.ts diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 7f594ad82b1..bcd8cebb017 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -886,12 +886,25 @@ namespace ts.formatting { else { const tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); const startLinePosition = 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: number, characterInLine: number): number { + let column = 0; + for (let i = 0; i < characterInLine; i++) { + if (sourceFile.text.charCodeAt(startLinePosition + i) === CharacterCodes.tab) { + column += options.tabSize - column % options.tabSize; + } + else { + column++; + } + } + return column; + } + function indentationIsDifferent(indentationString: string, startLinePosition: number): boolean { return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } diff --git a/tests/cases/fourslash/formatWithTabs.ts b/tests/cases/fourslash/formatWithTabs.ts new file mode 100644 index 00000000000..c33808bd26a --- /dev/null +++ b/tests/cases/fourslash/formatWithTabs.ts @@ -0,0 +1,16 @@ +/// + +////const foo = [ +//// 1 +////]; + +const options = format.copyFormatOptions(); +options.IndentSize = 2; +options.TabSize = 2; +options.ConvertTabsToSpaces = false; +format.setFormatOptions(options); +format.document(); +verify.currentFileContentIs( +`const foo = [ + 1 +];`); \ No newline at end of file diff --git a/tests/cases/fourslash/formatWithTabs2.ts b/tests/cases/fourslash/formatWithTabs2.ts new file mode 100644 index 00000000000..cda82b9cf80 --- /dev/null +++ b/tests/cases/fourslash/formatWithTabs2.ts @@ -0,0 +1,16 @@ +/// + +////const foo = [ +//// 1 +////]; + +const options = format.copyFormatOptions(); +options.IndentSize = 2; +options.TabSize = 2; +options.ConvertTabsToSpaces = false; +format.setFormatOptions(options); +format.document(); +verify.currentFileContentIs( +`const foo = [ + 1 +];`); \ No newline at end of file From 76ceab97dd744de160f28e2ec7412a6de4ca73dd Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 11:41:51 -0800 Subject: [PATCH 23/41] Make keyof T a string-like type --- src/compiler/checker.ts | 26 +++++++------------------- src/compiler/types.ts | 2 +- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fdb9f928928..3c8c0be77c7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -142,7 +142,6 @@ namespace ts { const voidType = createIntrinsicType(TypeFlags.Void, "void"); const neverType = createIntrinsicType(TypeFlags.Never, "never"); const silentNeverType = createIntrinsicType(TypeFlags.Never, "never"); - const stringOrNumberType = getUnionType([stringType, numberType]); const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -3219,6 +3218,8 @@ namespace ts { // A variable declared in a for..in statement is always of type string if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) { + // const indexType = getIndexType(checkNonNullExpression((declaration.parent.parent).expression)); + // return indexType.flags & TypeFlags.Index ? indexType : stringType; return stringType; } @@ -4688,7 +4689,6 @@ namespace ts { t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType() : - t.flags & TypeFlags.Index ? stringOrNumberType : t; } @@ -5920,8 +5920,7 @@ namespace ts { function getIndexType(type: Type): Type { return type.flags & TypeFlags.TypeParameter ? getIndexTypeForTypeParameter(type) : getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(type) : - type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringOrNumberType : - getIndexInfoOfType(type, IndexKind.Number) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) : + type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType : getLiteralTypeFromPropertyNames(type); } @@ -6040,10 +6039,9 @@ namespace ts { return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); } const apparentObjectType = getApparentType(objectType); - const apparentIndexType = indexType.flags & TypeFlags.Index ? stringOrNumberType : indexType; - if (apparentIndexType.flags & TypeFlags.Union && !(apparentIndexType.flags & TypeFlags.Primitive)) { + if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) { const propTypes: Type[] = []; - for (const t of (apparentIndexType).types) { + for (const t of (indexType).types) { const propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false); if (propType === unknownType) { return unknownType; @@ -6052,7 +6050,7 @@ namespace ts { } return getUnionType(propTypes); } - return getPropertyTypeForIndexType(apparentObjectType, apparentIndexType, accessNode, /*cacheSymbol*/ true); + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true); } function getTypeFromIndexedAccessTypeNode(node: IndexedAccessTypeNode) { @@ -7124,16 +7122,6 @@ namespace ts { if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return Ternary.True; - if (source.flags & TypeFlags.Index) { - // A keyof T is related to a union type containing both string and number - const related = relation === comparableRelation ? - maybeTypeOfKind(target, TypeFlags.String | TypeFlags.Number) : - maybeTypeOfKind(target, TypeFlags.String) && maybeTypeOfKind(target, TypeFlags.Number); - if (related) { - return Ternary.True; - } - } - if (getObjectFlags(source) & ObjectFlags.ObjectLiteral && source.flags & TypeFlags.FreshLiteral) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { @@ -15654,7 +15642,7 @@ namespace ts { const type = getTypeFromMappedTypeNode(node); const constraintType = getConstraintTypeFromMappedType(type); const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringOrNumberType, node.typeParameter.constraint); + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node: Node): boolean { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2b8b6fe294e..e79e136ac32 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2789,7 +2789,7 @@ namespace ts { Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never, /* @internal */ Primitive = String | Number | Boolean | Enum | ESSymbol | Void | Undefined | Null | Literal, - StringLike = String | StringLiteral, + StringLike = String | StringLiteral | Index, NumberLike = Number | NumberLiteral | Enum | EnumLiteral, BooleanLike = Boolean | BooleanLiteral, EnumLike = Enum | EnumLiteral, From 854a20f1febb50bfa4d814572adc777e8609b226 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 11:42:21 -0800 Subject: [PATCH 24/41] Update Record type --- src/lib/es5.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index e402a96fade..7ee47817802 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1367,7 +1367,7 @@ type Pick = { /** * Construct a type with a set of properties K of type T */ -type Record = { +type Record = { [P in K]: T; } From 5498a95245183dab4e0d6be25de6912361101017 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 11:42:38 -0800 Subject: [PATCH 25/41] Update tests --- .../types/keyof/keyofAndIndexedAccess.ts | 22 +++++-------------- .../types/mapped/mappedTypeErrors.ts | 5 +++-- .../conformance/types/mapped/mappedTypes1.ts | 8 ++----- .../conformance/types/mapped/mappedTypes2.ts | 2 +- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 522bfe34e15..690154cb7ac 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -95,22 +95,18 @@ function f10(shape: Shape) { function f11(a: Shape[]) { let len = getProperty(a, "length"); // number - let shape = getProperty(a, 1000); // Shape - setProperty(a, 1000, getProperty(a, 1001)); + setProperty(a, "length", len); } function f12(t: [Shape, boolean]) { let len = getProperty(t, "length"); - let s1 = getProperty(t, 0); // Shape let s2 = getProperty(t, "0"); // Shape - let b1 = getProperty(t, 1); // boolean let b2 = getProperty(t, "1"); // boolean - let x1 = getProperty(t, 2); // Shape | boolean } function f13(foo: any, bar: any) { let x = getProperty(foo, "x"); // any - let y = getProperty(foo, 100); // any + let y = getProperty(foo, "100"); // any let z = getProperty(foo, bar); // any } @@ -181,20 +177,14 @@ function f40(c: C) { let z: Z = c["z"]; } -function f50(k: keyof T, s: string, n: number) { +function f50(k: keyof T, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } -function f51(k: K, s: string, n: number) { +function f51(k: K, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index c507bf64a6e..b318cde3aab 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -20,8 +20,9 @@ interface Point { // Constraint checking type T00 = { [P in P]: string }; // Error -type T01 = { [P in Date]: number }; // Error -type T02 = Record; // Error +type T01 = { [P in number]: string }; // Error +type T02 = { [P in Date]: number }; // Error +type T03 = Record; // Error type T10 = Pick; type T11 = Pick; // Error diff --git a/tests/cases/conformance/types/mapped/mappedTypes1.ts b/tests/cases/conformance/types/mapped/mappedTypes1.ts index bfc68aaa59d..d090b731518 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes1.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes1.ts @@ -27,13 +27,9 @@ type T37 = { [P in keyof symbol]: void }; type T38 = { [P in keyof never]: void }; type T40 = { [P in string]: void }; -type T41 = { [P in number]: void }; -type T42 = { [P in string | number]: void }; -type T43 = { [P in "a" | "b" | 0 | 1]: void }; +type T43 = { [P in "a" | "b"]: void }; type T44 = { [P in "a" | "b" | "0" | "1"]: void }; -type T45 = { [P in "a" | "b" | "0" | "1" | 0 | 1]: void }; -type T46 = { [P in number | "a" | "b" | 0 | 1]: void }; -type T47 = { [P in string | number | "a" | "b" | 0 | 1]: void }; +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 }; diff --git a/tests/cases/conformance/types/mapped/mappedTypes2.ts b/tests/cases/conformance/types/mapped/mappedTypes2.ts index 7f5841410e4..e72a0c0a892 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes2.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes2.ts @@ -28,7 +28,7 @@ type DeepReadonly = { declare function assign(obj: T, props: Partial): void; 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 mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; interface Shape { From c5558482b7f2e3a8bc7b99ae1540c089b3e4d142 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 11:43:15 -0800 Subject: [PATCH 26/41] Accept new baselines --- .../reference/keyofAndIndexedAccess.js | 48 +- .../reference/keyofAndIndexedAccess.symbols | 621 ++++++++---------- .../reference/keyofAndIndexedAccess.types | 107 +-- .../reference/mappedTypeErrors.errors.txt | 42 +- tests/baselines/reference/mappedTypeErrors.js | 10 +- tests/baselines/reference/mappedTypes1.js | 25 +- .../baselines/reference/mappedTypes1.symbols | 64 +- tests/baselines/reference/mappedTypes1.types | 24 +- tests/baselines/reference/mappedTypes2.js | 4 +- .../baselines/reference/mappedTypes2.symbols | 24 +- tests/baselines/reference/mappedTypes2.types | 6 +- 11 files changed, 398 insertions(+), 577 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index eef81f4d5f7..017669603a4 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -95,22 +95,18 @@ function f10(shape: Shape) { function f11(a: Shape[]) { let len = getProperty(a, "length"); // number - let shape = getProperty(a, 1000); // Shape - setProperty(a, 1000, getProperty(a, 1001)); + setProperty(a, "length", len); } function f12(t: [Shape, boolean]) { let len = getProperty(t, "length"); - let s1 = getProperty(t, 0); // Shape let s2 = getProperty(t, "0"); // Shape - let b1 = getProperty(t, 1); // boolean let b2 = getProperty(t, "1"); // boolean - let x1 = getProperty(t, 2); // Shape | boolean } function f13(foo: any, bar: any) { let x = getProperty(foo, "x"); // any - let y = getProperty(foo, 100); // any + let y = getProperty(foo, "100"); // any let z = getProperty(foo, bar); // any } @@ -181,20 +177,14 @@ function f40(c: C) { let z: Z = c["z"]; } -function f50(k: keyof T, s: string, n: number) { +function f50(k: keyof T, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } -function f51(k: K, s: string, n: number) { +function f51(k: K, s: string) { const x1 = s as keyof T; - const x2 = n as keyof T; - const x3 = k as string; - const x4 = k as number; - const x5 = k as string | number; + const x2 = k as string; } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { @@ -297,20 +287,16 @@ function f10(shape) { } function f11(a) { var len = getProperty(a, "length"); // number - var shape = getProperty(a, 1000); // Shape - setProperty(a, 1000, getProperty(a, 1001)); + setProperty(a, "length", len); } function f12(t) { var len = getProperty(t, "length"); - var s1 = getProperty(t, 0); // Shape var s2 = getProperty(t, "0"); // Shape - var b1 = getProperty(t, 1); // boolean var b2 = getProperty(t, "1"); // boolean - var x1 = getProperty(t, 2); // Shape | boolean } function f13(foo, bar) { var x = getProperty(foo, "x"); // any - var y = getProperty(foo, 100); // any + var y = getProperty(foo, "100"); // any var z = getProperty(foo, bar); // any } var Component = (function () { @@ -369,19 +355,13 @@ function f40(c) { var y = c["y"]; var z = c["z"]; } -function f50(k, s, n) { +function f50(k, s) { var x1 = s; - var x2 = n; - var x3 = k; - var x4 = k; - var x5 = k; + var x2 = k; } -function f51(k, s, n) { +function f51(k, s) { var x1 = s; - var x2 = n; - var x3 = k; - var x4 = k; - var x5 = k; + var x2 = k; } function f52(obj, k, s, n) { var x1 = obj[s]; @@ -528,8 +508,8 @@ declare class C { private z; } declare function f40(c: C): void; -declare function f50(k: keyof T, s: string, n: number): void; -declare function f51(k: K, s: string, n: number): void; +declare function f50(k: keyof T, s: string): void; +declare function f51(k: K, s: string): void; declare function f52(obj: { [x: string]: boolean; }, k: keyof T, s: string, n: number): void; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 0b10e368821..8a2f1052d13 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -299,569 +299,520 @@ function f11(a: Shape[]) { >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) >a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) - let shape = getProperty(a, 1000); // Shape ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 96, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) - - setProperty(a, 1000, getProperty(a, 1001)); + setProperty(a, "length", len); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) >a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 95, 7)) } function f12(t: [Shape, boolean]) { ->f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 98, 1)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) +>f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 97, 1)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let len = getProperty(t, "length"); ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 101, 7)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 100, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) - - let s1 = getProperty(t, 0); // Shape ->s1 : Symbol(s1, Decl(keyofAndIndexedAccess.ts, 102, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) let s2 = getProperty(t, "0"); // Shape ->s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 103, 7)) +>s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 101, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) - - let b1 = getProperty(t, 1); // boolean ->b1 : Symbol(b1, Decl(keyofAndIndexedAccess.ts, 104, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) let b2 = getProperty(t, "1"); // boolean ->b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 105, 7)) +>b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 102, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) - - let x1 = getProperty(t, 2); // Shape | boolean ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 106, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 100, 13)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) } function f13(foo: any, bar: any) { ->f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 107, 1)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 109, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 109, 22)) +>f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 103, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) let x = getProperty(foo, "x"); // any ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 110, 7)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 106, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 109, 13)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) - let y = getProperty(foo, 100); // any ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 111, 7)) + 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, 109, 13)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) let z = getProperty(foo, bar); // any ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 112, 7)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 108, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 109, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 109, 22)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) } class Component { ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 113, 1)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 115, 16)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) props: PropType; ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 115, 27)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 115, 16)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) getProperty(key: K) { ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 117, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 115, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 117, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 117, 16)) +>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)) return this.props[key]; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 115, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 113, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 115, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 117, 42)) +>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)) } setProperty(key: K, value: PropType[K]) { ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 120, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 115, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 120, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 120, 16)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 120, 49)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 115, 16)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 120, 16)) +>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)) this.props[key] = value; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 115, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 113, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 115, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 120, 42)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 120, 49)) +>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)) } } function f20(component: Component) { ->f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 123, 1)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 113, 1)) +>f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 119, 1)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let name = component.getProperty("name"); // string ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 126, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) +>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)) let widthOrHeight = component.getProperty(cond ? "width" : "height"); // number ->widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 127, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) +>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)) let nameOrVisible = component.getProperty(cond ? "name" : "visible"); // string | boolean ->nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 128, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 116, 20)) +>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)) component.setProperty("name", "rectangle"); ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) +>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(cond ? "width" : "height", 10) ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) +>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(cond ? "name" : "visible", true); // Technically not safe ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 125, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 119, 5)) +>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)) } function pluck(array: T[], key: K) { ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 134, 15)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 134, 17)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 134, 15)) ->array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 134, 37)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 134, 15)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 134, 48)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 134, 17)) +>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)) 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, 134, 37)) +>array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 130, 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, 135, 21)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 135, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 134, 48)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 130, 48)) } function f30(shapes: Shape[]) { ->f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 136, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 138, 13)) +>f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 132, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let names = pluck(shapes, "name"); // string[] ->names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 139, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 138, 13)) +>names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 135, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) let widths = pluck(shapes, "width"); // number[] ->widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 140, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 138, 13)) +>widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 136, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) let nameOrVisibles = pluck(shapes, cond ? "name" : "visible"); // (string | boolean)[] ->nameOrVisibles : Symbol(nameOrVisibles, Decl(keyofAndIndexedAccess.ts, 141, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 138, 13)) +>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)) } function f31(key: K) { ->f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 142, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 144, 13)) +>f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 138, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 144, 36)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 144, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 145, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 145, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 145, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 145, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 145, 61)) +>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)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 145, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 144, 36)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) } function f32(key: K) { ->f32 : Symbol(f32, Decl(keyofAndIndexedAccess.ts, 147, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 149, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 149, 43)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 149, 13)) +>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)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 150, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 150, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 150, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 150, 61)) +>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)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 149, 43)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 145, 43)) } function f33(shape: S, key: K) { ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 152, 1)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 154, 13)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 154, 29)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 154, 13)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 154, 49)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 154, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 154, 58)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 154, 29)) +>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)) let name = getProperty(shape, "name"); ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 155, 7)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 151, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 154, 49)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) let prop = getProperty(shape, key); ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 156, 7)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 154, 49)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 154, 58)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 150, 58)) return prop; ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 156, 7)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) } function f34(ts: TaggedShape) { ->f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 158, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 160, 13)) +>f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 154, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) >TaggedShape : Symbol(TaggedShape, Decl(keyofAndIndexedAccess.ts, 6, 1)) let tag1 = f33(ts, "tag"); ->tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 161, 7)) ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 152, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 160, 13)) +>tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 157, 7)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) let tag2 = getProperty(ts, "tag"); ->tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 162, 7)) +>tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 158, 7)) >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 160, 13)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) } class C { ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 163, 1)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) public x: string; ->x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 165, 9)) +>x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 161, 9)) protected y: string; ->y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 166, 21)) +>y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 162, 21)) private z: string; ->z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 167, 24)) +>z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 163, 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, 169, 1)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 173, 13)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 163, 1)) +>f40 : Symbol(f40, Decl(keyofAndIndexedAccess.ts, 165, 1)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) type X = C["x"]; ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 173, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 163, 1)) +>X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 169, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) type Y = C["y"]; ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 174, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 163, 1)) +>Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 170, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) type Z = C["z"]; ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 175, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 163, 1)) +>Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 171, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) let x: X = c["x"]; ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 177, 7)) ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 173, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 173, 13)) ->"x" : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 165, 9)) +>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)) let y: Y = c["y"]; ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 178, 7)) ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 174, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 173, 13)) ->"y" : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 166, 21)) +>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)) let z: Z = c["z"]; ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 179, 7)) ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 175, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 173, 13)) ->"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 167, 24)) +>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)) } -function f50(k: keyof T, s: string, n: number) { ->f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 180, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38)) +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)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 183, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 182, 27)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 179, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 178, 27)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) - const x2 = n as keyof T; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 184, 9)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 182, 38)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 182, 13)) - - const x3 = k as string; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 185, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) - - const x4 = k as number; ->x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 186, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) - - const x5 = k as string | number; ->x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 187, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 182, 16)) + const x2 = k as string; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 180, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 178, 16)) } -function f51(k: K, s: string, n: number) { ->f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 188, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 190, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51)) +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)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 191, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 40)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 184, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 183, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) - const x2 = n as keyof T; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 192, 9)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 51)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) - - const x3 = k as string; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 193, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) - - const x4 = k as number; ->x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 194, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) - - const x5 = k as string | number; ->x5 : Symbol(x5, Decl(keyofAndIndexedAccess.ts, 195, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 35)) + const x2 = k as string; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 185, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 183, 35)) } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { ->f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 196, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 198, 24)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 198, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69)) +>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)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 199, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 198, 58)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 189, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 188, 58)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 200, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 198, 69)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 190, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 188, 69)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 201, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 198, 16)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 198, 46)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 191, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 188, 46)) } function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { ->f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 202, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 204, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 204, 43)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 204, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82)) +>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)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 205, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 204, 71)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 195, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 194, 71)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 206, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 204, 82)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 196, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 194, 82)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 207, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 204, 35)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 204, 65)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 197, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 194, 65)) } function f54(obj: T, key: keyof T) { ->f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 208, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 210, 13)) +>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)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 211, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 201, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 213, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 210, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 210, 23)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 203, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) } function f55(obj: T, key: K) { ->f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 214, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 216, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 216, 15)) +>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)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 217, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 207, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 219, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 216, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 216, 42)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 209, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) } // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 225, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 215, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 215, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 215, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 225, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 215, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 228, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 218, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 218, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 228, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 228, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 218, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 218, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 233, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 223, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 225, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 220, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 227, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 235, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 225, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 238, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 228, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 231, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 224, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 244, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 234, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 236, 16)) setProperty(this, "parts", parts); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 246, 16)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 236, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 248, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 238, 5)) return getProperty(this, "parts") >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 242, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 020ac114126..4c09909c0fd 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -54,10 +54,10 @@ const enum E { A, B, C } >C : E.C type K00 = keyof any; // string | number ->K00 : string | number +>K00 : string type K01 = keyof string; // number | "toString" | "charAt" | ... ->K01 : number | "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | "valueOf" +>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" | ... >K02 : "toString" | "toLocaleString" | "valueOf" | "toFixed" | "toExponential" | "toPrecision" @@ -83,11 +83,11 @@ type K10 = keyof Shape; // "name" | "width" | "height" | "visible" >Shape : Shape type K11 = keyof Shape[]; // number | "length" | "toString" | ... ->K11 : number | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" +>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 ->K12 : string | number +>K12 : string >Dictionary : Dictionary >Shape : Shape @@ -103,7 +103,7 @@ type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... >E : E type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... ->K16 : number | "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" +>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" >K17 : "name" @@ -126,7 +126,7 @@ type K20 = KeyOf; // "name" | "width" | "height" | "visible" >Shape : Shape type K21 = KeyOf>; // string | number ->K21 : string | number +>K21 : string >KeyOf : keyof T >Dictionary : Dictionary >Shape : Shape @@ -328,22 +328,12 @@ function f11(a: Shape[]) { >a : Shape[] >"length" : "length" - let shape = getProperty(a, 1000); // Shape ->shape : Shape ->getProperty(a, 1000) : Shape ->getProperty : (obj: T, key: K) => T[K] ->a : Shape[] ->1000 : 1000 - - setProperty(a, 1000, getProperty(a, 1001)); ->setProperty(a, 1000, getProperty(a, 1001)) : void + setProperty(a, "length", len); +>setProperty(a, "length", len) : void >setProperty : (obj: T, key: K, value: T[K]) => void >a : Shape[] ->1000 : 1000 ->getProperty(a, 1001) : Shape ->getProperty : (obj: T, key: K) => T[K] ->a : Shape[] ->1001 : 1001 +>"length" : "length" +>len : number } function f12(t: [Shape, boolean]) { @@ -358,13 +348,6 @@ function f12(t: [Shape, boolean]) { >t : [Shape, boolean] >"length" : "length" - let s1 = getProperty(t, 0); // Shape ->s1 : Shape ->getProperty(t, 0) : Shape ->getProperty : (obj: T, key: K) => T[K] ->t : [Shape, boolean] ->0 : 0 - let s2 = getProperty(t, "0"); // Shape >s2 : Shape >getProperty(t, "0") : Shape @@ -372,26 +355,12 @@ function f12(t: [Shape, boolean]) { >t : [Shape, boolean] >"0" : "0" - let b1 = getProperty(t, 1); // boolean ->b1 : boolean ->getProperty(t, 1) : boolean ->getProperty : (obj: T, key: K) => T[K] ->t : [Shape, boolean] ->1 : 1 - let b2 = getProperty(t, "1"); // boolean >b2 : boolean >getProperty(t, "1") : boolean >getProperty : (obj: T, key: K) => T[K] >t : [Shape, boolean] >"1" : "1" - - let x1 = getProperty(t, 2); // Shape | boolean ->x1 : boolean | Shape ->getProperty(t, 2) : boolean | Shape ->getProperty : (obj: T, key: K) => T[K] ->t : [Shape, boolean] ->2 : 2 } function f13(foo: any, bar: any) { @@ -406,12 +375,12 @@ function f13(foo: any, bar: any) { >foo : any >"x" : "x" - let y = getProperty(foo, 100); // any + let y = getProperty(foo, "100"); // any >y : any ->getProperty(foo, 100) : any +>getProperty(foo, "100") : any >getProperty : (obj: T, key: K) => T[K] >foo : any ->100 : 100 +>"100" : "100" let z = getProperty(foo, bar); // any >z : any @@ -737,13 +706,12 @@ function f40(c: C) { >"z" : "z" } -function f50(k: keyof T, s: string, n: number) { ->f50 : (k: keyof T, s: string, n: number) => void +function f50(k: keyof T, s: string) { +>f50 : (k: keyof T, s: string) => void >T : T >k : keyof T >T : T >s : string ->n : number const x1 = s as keyof T; >x1 : keyof T @@ -751,37 +719,20 @@ function f50(k: keyof T, s: string, n: number) { >s : string >T : T - const x2 = n as keyof T; ->x2 : keyof T ->n as keyof T : keyof T ->n : number ->T : T - - const x3 = k as string; ->x3 : string + const x2 = k as string; +>x2 : string >k as string : string ->k : keyof T - - const x4 = k as number; ->x4 : number ->k as number : number ->k : keyof T - - const x5 = k as string | number; ->x5 : string | number ->k as string | number : string | number >k : keyof T } -function f51(k: K, s: string, n: number) { ->f51 : (k: K, s: string, n: number) => void +function f51(k: K, s: string) { +>f51 : (k: K, s: string) => void >T : T >K : K >T : T >k : K >K : K >s : string ->n : number const x1 = s as keyof T; >x1 : keyof T @@ -789,25 +740,9 @@ function f51(k: K, s: string, n: number) { >s : string >T : T - const x2 = n as keyof T; ->x2 : keyof T ->n as keyof T : keyof T ->n : number ->T : T - - const x3 = k as string; ->x3 : string + const x2 = k as string; +>x2 : string >k as string : string ->k : K - - const x4 = k as number; ->x4 : number ->k as number : number ->k : K - - const x5 = k as string | number; ->x5 : string | number ->k as string | number : string | number >k : K } diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 0e1198285ba..b3cba7eb54d 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -1,29 +1,28 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(20,20): error TS2313: Type parameter 'P' has a circular constraint. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(21,20): error TS2322: Type 'Date' is not assignable to type 'string | number'. - Type 'Date' is not assignable to type 'number'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(22,19): error TS2344: Type 'Date' does not satisfy the constraint 'string | number'. - Type 'Date' is not assignable to type 'number'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(25,24): error TS2344: Type '"foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(26,24): error TS2344: Type '"name" | "foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(21,20): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(22,20): error TS2322: Type 'Date' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(23,19): error TS2344: Type 'Date' does not satisfy the constraint 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(26,24): error TS2344: Type '"foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(27,24): error TS2344: Type '"name" | "foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. Type '"foo"' is not assignable to type '"name" | "width" | "height" | "visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(28,24): error TS2344: Type '"x" | "y"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(29,24): error TS2344: Type '"x" | "y"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. Type '"x"' is not assignable to type '"name" | "width" | "height" | "visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(30,24): error TS2344: Type 'undefined' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(33,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(31,24): error TS2344: Type 'undefined' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(34,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. Type 'T' is not assignable to type '"visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(37,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(38,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'. Type 'string | number' is not assignable to type '"name" | "width" | "height" | "visible"'. Type 'string' is not assignable to type '"name" | "width" | "height" | "visible"'. 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(59,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 '{ readonly [P in keyof T]: T[P]; }'. -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(66,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]; }'. +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(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 (13 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (14 errors) ==== interface Shape { name: string; @@ -46,14 +45,15 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Su type T00 = { [P in P]: string }; // Error ~ !!! error TS2313: Type parameter 'P' has a circular constraint. - type T01 = { [P in Date]: number }; // Error + type T01 = { [P in number]: string }; // Error + ~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + type T02 = { [P in Date]: number }; // Error ~~~~ -!!! error TS2322: Type 'Date' is not assignable to type 'string | number'. -!!! error TS2322: Type 'Date' is not assignable to type 'number'. - type T02 = Record; // Error +!!! error TS2322: Type 'Date' is not assignable to type 'string'. + type T03 = Record; // Error ~~~~ -!!! error TS2344: Type 'Date' does not satisfy the constraint 'string | number'. -!!! error TS2344: Type 'Date' is not assignable to type 'number'. +!!! error TS2344: Type 'Date' does not satisfy the constraint 'string'. type T10 = Pick; type T11 = Pick; // Error diff --git a/tests/baselines/reference/mappedTypeErrors.js b/tests/baselines/reference/mappedTypeErrors.js index fe03b5c9593..cb840da32f7 100644 --- a/tests/baselines/reference/mappedTypeErrors.js +++ b/tests/baselines/reference/mappedTypeErrors.js @@ -19,8 +19,9 @@ interface Point { // Constraint checking type T00 = { [P in P]: string }; // Error -type T01 = { [P in Date]: number }; // Error -type T02 = Record; // Error +type T01 = { [P in number]: string }; // Error +type T02 = { [P in Date]: number }; // Error +type T03 = Record; // Error type T10 = Pick; type T11 = Pick; // Error @@ -116,9 +117,12 @@ declare type T00 = { [P in P]: string; }; declare type T01 = { + [P in number]: string; +}; +declare type T02 = { [P in Date]: number; }; -declare type T02 = Record; +declare type T03 = Record; declare type T10 = Pick; declare type T11 = Pick; declare type T12 = Pick; diff --git a/tests/baselines/reference/mappedTypes1.js b/tests/baselines/reference/mappedTypes1.js index 71a8d5abb67..a172b637d1c 100644 --- a/tests/baselines/reference/mappedTypes1.js +++ b/tests/baselines/reference/mappedTypes1.js @@ -26,13 +26,9 @@ type T37 = { [P in keyof symbol]: void }; type T38 = { [P in keyof never]: void }; type T40 = { [P in string]: void }; -type T41 = { [P in number]: void }; -type T42 = { [P in string | number]: void }; -type T43 = { [P in "a" | "b" | 0 | 1]: void }; +type T43 = { [P in "a" | "b"]: void }; type T44 = { [P in "a" | "b" | "0" | "1"]: void }; -type T45 = { [P in "a" | "b" | "0" | "1" | 0 | 1]: void }; -type T46 = { [P in number | "a" | "b" | 0 | 1]: void }; -type T47 = { [P in string | number | "a" | "b" | 0 | 1]: void }; +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 }; @@ -114,26 +110,14 @@ declare type T38 = { declare type T40 = { [P in string]: void; }; -declare type T41 = { - [P in number]: void; -}; -declare type T42 = { - [P in string | number]: void; -}; declare type T43 = { - [P in "a" | "b" | 0 | 1]: void; + [P in "a" | "b"]: void; }; declare type T44 = { [P in "a" | "b" | "0" | "1"]: void; }; -declare type T45 = { - [P in "a" | "b" | "0" | "1" | 0 | 1]: void; -}; -declare type T46 = { - [P in number | "a" | "b" | 0 | 1]: void; -}; declare type T47 = { - [P in string | number | "a" | "b" | 0 | 1]: void; + [P in string | "a" | "b" | "0" | "1"]: void; }; declare function f1(): { [P in keyof T1]: void; @@ -146,7 +130,6 @@ declare function f3(): { }; declare let x1: {}; declare let x2: { - [x: number]: void; toString: void; charAt: void; charCodeAt: void; diff --git a/tests/baselines/reference/mappedTypes1.symbols b/tests/baselines/reference/mappedTypes1.symbols index 908fbb3b0e1..88ced68aa0e 100644 --- a/tests/baselines/reference/mappedTypes1.symbols +++ b/tests/baselines/reference/mappedTypes1.symbols @@ -110,61 +110,45 @@ type T40 = { [P in string]: void }; >T40 : Symbol(T40, Decl(mappedTypes1.ts, 24, 40)) >P : Symbol(P, Decl(mappedTypes1.ts, 26, 14)) -type T41 = { [P in number]: void }; ->T41 : Symbol(T41, Decl(mappedTypes1.ts, 26, 35)) +type T43 = { [P in "a" | "b"]: void }; +>T43 : Symbol(T43, Decl(mappedTypes1.ts, 26, 35)) >P : Symbol(P, Decl(mappedTypes1.ts, 27, 14)) -type T42 = { [P in string | number]: void }; ->T42 : Symbol(T42, Decl(mappedTypes1.ts, 27, 35)) +type T44 = { [P in "a" | "b" | "0" | "1"]: void }; +>T44 : Symbol(T44, Decl(mappedTypes1.ts, 27, 38)) >P : Symbol(P, Decl(mappedTypes1.ts, 28, 14)) -type T43 = { [P in "a" | "b" | 0 | 1]: void }; ->T43 : Symbol(T43, Decl(mappedTypes1.ts, 28, 44)) +type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; +>T47 : Symbol(T47, Decl(mappedTypes1.ts, 28, 50)) >P : Symbol(P, Decl(mappedTypes1.ts, 29, 14)) -type T44 = { [P in "a" | "b" | "0" | "1"]: void }; ->T44 : Symbol(T44, Decl(mappedTypes1.ts, 29, 46)) ->P : Symbol(P, Decl(mappedTypes1.ts, 30, 14)) - -type T45 = { [P in "a" | "b" | "0" | "1" | 0 | 1]: void }; ->T45 : Symbol(T45, Decl(mappedTypes1.ts, 30, 50)) ->P : Symbol(P, Decl(mappedTypes1.ts, 31, 14)) - -type T46 = { [P in number | "a" | "b" | 0 | 1]: void }; ->T46 : Symbol(T46, Decl(mappedTypes1.ts, 31, 58)) ->P : Symbol(P, Decl(mappedTypes1.ts, 32, 14)) - -type T47 = { [P in string | number | "a" | "b" | 0 | 1]: void }; ->T47 : Symbol(T47, Decl(mappedTypes1.ts, 32, 55)) ->P : Symbol(P, Decl(mappedTypes1.ts, 33, 14)) - declare function f1(): { [P in keyof T1]: void }; ->f1 : Symbol(f1, Decl(mappedTypes1.ts, 33, 64)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 35, 20)) ->P : Symbol(P, Decl(mappedTypes1.ts, 35, 30)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 35, 20)) +>f1 : Symbol(f1, Decl(mappedTypes1.ts, 29, 59)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 31, 20)) +>P : Symbol(P, Decl(mappedTypes1.ts, 31, 30)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 31, 20)) declare function f2(): { [P in keyof T1]: void }; ->f2 : Symbol(f2, Decl(mappedTypes1.ts, 35, 53)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 36, 20)) ->P : Symbol(P, Decl(mappedTypes1.ts, 36, 45)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 36, 20)) +>f2 : Symbol(f2, Decl(mappedTypes1.ts, 31, 53)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 32, 20)) +>P : Symbol(P, Decl(mappedTypes1.ts, 32, 45)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 32, 20)) declare function f3(): { [P in keyof T1]: void }; ->f3 : Symbol(f3, Decl(mappedTypes1.ts, 36, 68)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 37, 20)) ->P : Symbol(P, Decl(mappedTypes1.ts, 37, 45)) ->T1 : Symbol(T1, Decl(mappedTypes1.ts, 37, 20)) +>f3 : Symbol(f3, Decl(mappedTypes1.ts, 32, 68)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 33, 20)) +>P : Symbol(P, Decl(mappedTypes1.ts, 33, 45)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 33, 20)) let x1 = f1(); ->x1 : Symbol(x1, Decl(mappedTypes1.ts, 39, 3)) ->f1 : Symbol(f1, Decl(mappedTypes1.ts, 33, 64)) +>x1 : Symbol(x1, Decl(mappedTypes1.ts, 35, 3)) +>f1 : Symbol(f1, Decl(mappedTypes1.ts, 29, 59)) let x2 = f2(); ->x2 : Symbol(x2, Decl(mappedTypes1.ts, 40, 3)) ->f2 : Symbol(f2, Decl(mappedTypes1.ts, 35, 53)) +>x2 : Symbol(x2, Decl(mappedTypes1.ts, 36, 3)) +>f2 : Symbol(f2, Decl(mappedTypes1.ts, 31, 53)) let x3 = f3(); ->x3 : Symbol(x3, Decl(mappedTypes1.ts, 41, 3)) ->f3 : Symbol(f3, Decl(mappedTypes1.ts, 36, 68)) +>x3 : Symbol(x3, Decl(mappedTypes1.ts, 37, 3)) +>f3 : Symbol(f3, Decl(mappedTypes1.ts, 32, 68)) diff --git a/tests/baselines/reference/mappedTypes1.types b/tests/baselines/reference/mappedTypes1.types index 06aeaa89621..6886810c394 100644 --- a/tests/baselines/reference/mappedTypes1.types +++ b/tests/baselines/reference/mappedTypes1.types @@ -112,15 +112,7 @@ type T40 = { [P in string]: void }; >T40 : T40 >P : P -type T41 = { [P in number]: void }; ->T41 : T41 ->P : P - -type T42 = { [P in string | number]: void }; ->T42 : T42 ->P : P - -type T43 = { [P in "a" | "b" | 0 | 1]: void }; +type T43 = { [P in "a" | "b"]: void }; >T43 : T43 >P : P @@ -128,15 +120,7 @@ type T44 = { [P in "a" | "b" | "0" | "1"]: void }; >T44 : T44 >P : P -type T45 = { [P in "a" | "b" | "0" | "1" | 0 | 1]: void }; ->T45 : T45 ->P : P - -type T46 = { [P in number | "a" | "b" | 0 | 1]: void }; ->T46 : T46 ->P : P - -type T47 = { [P in string | number | "a" | "b" | 0 | 1]: void }; +type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; >T47 : T47 >P : P @@ -164,8 +148,8 @@ let x1 = f1(); >f1 : () => { [P in keyof T1]: void; } let x2 = f2(); ->x2 : { [x: number]: void; 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() : { [x: number]: void; 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 : { 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; } >f2 : () => { [P in keyof T1]: void; } let x3 = f3(); diff --git a/tests/baselines/reference/mappedTypes2.js b/tests/baselines/reference/mappedTypes2.js index 25bb3fb6ded..580cb36c741 100644 --- a/tests/baselines/reference/mappedTypes2.js +++ b/tests/baselines/reference/mappedTypes2.js @@ -27,7 +27,7 @@ type DeepReadonly = { declare function assign(obj: T, props: Partial): void; 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 mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; interface Shape { @@ -148,7 +148,7 @@ declare type DeepReadonly = { declare function assign(obj: T, props: Partial): void; 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 mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; interface Shape { name: string; diff --git a/tests/baselines/reference/mappedTypes2.symbols b/tests/baselines/reference/mappedTypes2.symbols index a610658869e..1b6fe299140 100644 --- a/tests/baselines/reference/mappedTypes2.symbols +++ b/tests/baselines/reference/mappedTypes2.symbols @@ -126,25 +126,25 @@ declare function pick(obj: T, ...keys: K[]): Pick; >T : Symbol(T, Decl(mappedTypes2.ts, 27, 22)) >K : Symbol(K, Decl(mappedTypes2.ts, 27, 24)) -declare function mapObject(obj: Record, f: (x: T) => U): Record; +declare function mapObject(obj: Record, f: (x: T) => U): Record; >mapObject : Symbol(mapObject, Decl(mappedTypes2.ts, 27, 78)) >K : Symbol(K, Decl(mappedTypes2.ts, 28, 27)) ->T : Symbol(T, Decl(mappedTypes2.ts, 28, 53)) ->U : Symbol(U, Decl(mappedTypes2.ts, 28, 56)) ->obj : Symbol(obj, Decl(mappedTypes2.ts, 28, 60)) +>T : Symbol(T, Decl(mappedTypes2.ts, 28, 44)) +>U : Symbol(U, Decl(mappedTypes2.ts, 28, 47)) +>obj : Symbol(obj, Decl(mappedTypes2.ts, 28, 51)) >Record : Symbol(Record, Decl(lib.d.ts, --, --)) >K : Symbol(K, Decl(mappedTypes2.ts, 28, 27)) ->T : Symbol(T, Decl(mappedTypes2.ts, 28, 53)) ->f : Symbol(f, Decl(mappedTypes2.ts, 28, 78)) ->x : Symbol(x, Decl(mappedTypes2.ts, 28, 83)) ->T : Symbol(T, Decl(mappedTypes2.ts, 28, 53)) ->U : Symbol(U, Decl(mappedTypes2.ts, 28, 56)) +>T : Symbol(T, Decl(mappedTypes2.ts, 28, 44)) +>f : Symbol(f, Decl(mappedTypes2.ts, 28, 69)) +>x : Symbol(x, Decl(mappedTypes2.ts, 28, 74)) +>T : Symbol(T, Decl(mappedTypes2.ts, 28, 44)) +>U : Symbol(U, Decl(mappedTypes2.ts, 28, 47)) >Record : Symbol(Record, Decl(lib.d.ts, --, --)) >K : Symbol(K, Decl(mappedTypes2.ts, 28, 27)) ->U : Symbol(U, Decl(mappedTypes2.ts, 28, 56)) +>U : Symbol(U, Decl(mappedTypes2.ts, 28, 47)) declare function proxify(obj: T): Proxify; ->proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 109)) +>proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 100)) >T : Symbol(T, Decl(mappedTypes2.ts, 29, 25)) >obj : Symbol(obj, Decl(mappedTypes2.ts, 29, 28)) >T : Symbol(T, Decl(mappedTypes2.ts, 29, 25)) @@ -295,7 +295,7 @@ function f5(shape: Shape) { const p = proxify(shape); >p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) ->proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 109)) +>proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 100)) >shape : Symbol(shape, Decl(mappedTypes2.ts, 78, 12)) let name = p.name.get(); diff --git a/tests/baselines/reference/mappedTypes2.types b/tests/baselines/reference/mappedTypes2.types index 8c487288a6f..14ca77e4680 100644 --- a/tests/baselines/reference/mappedTypes2.types +++ b/tests/baselines/reference/mappedTypes2.types @@ -126,8 +126,8 @@ declare function pick(obj: T, ...keys: K[]): Pick; >T : T >K : K -declare function mapObject(obj: Record, f: (x: T) => U): Record; ->mapObject : (obj: Record, f: (x: T) => U) => Record +declare function mapObject(obj: Record, f: (x: T) => U): Record; +>mapObject : (obj: Record, f: (x: T) => U) => Record >K : K >T : T >U : U @@ -297,7 +297,7 @@ function f4() { const lengths = mapObject(rec, s => s.length); // { foo: number, bar: number, baz: number } >lengths : Record<"foo" | "bar" | "baz", number> >mapObject(rec, s => s.length) : Record<"foo" | "bar" | "baz", number> ->mapObject : (obj: Record, f: (x: T) => U) => Record +>mapObject : (obj: Record, f: (x: T) => U) => Record >rec : { foo: string; bar: string; baz: string; } >s => s.length : (s: string) => number >s : string From 4c6b94f16fbf9752181178a95bb3f53e9d2f6ef2 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 21 Nov 2016 12:52:13 -0800 Subject: [PATCH 27/41] wrap subexpressions of conditional expressions in parens if necessary (#12420) --- src/compiler/factory.ts | 17 ++++++++--- .../commaOperatorInConditionalExpression.js | 14 +++++++++ ...mmaOperatorInConditionalExpression.symbols | 18 +++++++++++ ...commaOperatorInConditionalExpression.types | 30 +++++++++++++++++++ .../commaOperatorInConditionalExpression.ts | 5 ++++ 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/commaOperatorInConditionalExpression.js create mode 100644 tests/baselines/reference/commaOperatorInConditionalExpression.symbols create mode 100644 tests/baselines/reference/commaOperatorInConditionalExpression.types create mode 100644 tests/cases/compiler/commaOperatorInConditionalExpression.ts diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index d797fff92f4..63333dbe0b2 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -654,16 +654,16 @@ namespace ts { if (whenFalse) { // second overload node.questionToken = questionTokenOrWhenTrue; - node.whenTrue = whenTrueOrWhenFalse; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); node.colonToken = colonTokenOrLocation; - node.whenFalse = whenFalse; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenFalse); } else { // first overload node.questionToken = createToken(SyntaxKind.QuestionToken); - node.whenTrue = questionTokenOrWhenTrue; + node.whenTrue = parenthesizeSubexpressionOfConditionalExpression(questionTokenOrWhenTrue); node.colonToken = createToken(SyntaxKind.ColonToken); - node.whenFalse = whenTrueOrWhenFalse; + node.whenFalse = parenthesizeSubexpressionOfConditionalExpression(whenTrueOrWhenFalse); } return node; } @@ -2381,6 +2381,15 @@ namespace ts { return condition; } + function parenthesizeSubexpressionOfConditionalExpression(e: Expression): Expression { + // 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 === SyntaxKind.BinaryExpression && (e).operatorToken.kind === SyntaxKind.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. diff --git a/tests/baselines/reference/commaOperatorInConditionalExpression.js b/tests/baselines/reference/commaOperatorInConditionalExpression.js new file mode 100644 index 00000000000..be1705936e4 --- /dev/null +++ b/tests/baselines/reference/commaOperatorInConditionalExpression.js @@ -0,0 +1,14 @@ +//// [commaOperatorInConditionalExpression.ts] +function f (m: string) { + [1, 2, 3].map(i => { + return true? { [m]: i } : { [m]: i + 1 } + }) +} + +//// [commaOperatorInConditionalExpression.js] +function f(m) { + [1, 2, 3].map(function (i) { + return true ? (_a = {}, _a[m] = i, _a) : (_b = {}, _b[m] = i + 1, _b); + var _a, _b; + }); +} diff --git a/tests/baselines/reference/commaOperatorInConditionalExpression.symbols b/tests/baselines/reference/commaOperatorInConditionalExpression.symbols new file mode 100644 index 00000000000..18f749c5c5c --- /dev/null +++ b/tests/baselines/reference/commaOperatorInConditionalExpression.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/commaOperatorInConditionalExpression.ts === +function f (m: string) { +>f : Symbol(f, Decl(commaOperatorInConditionalExpression.ts, 0, 0)) +>m : Symbol(m, Decl(commaOperatorInConditionalExpression.ts, 0, 12)) + + [1, 2, 3].map(i => { +>[1, 2, 3].map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>i : Symbol(i, Decl(commaOperatorInConditionalExpression.ts, 1, 18)) + + return true? { [m]: i } : { [m]: i + 1 } +>m : Symbol(m, Decl(commaOperatorInConditionalExpression.ts, 0, 12)) +>i : Symbol(i, Decl(commaOperatorInConditionalExpression.ts, 1, 18)) +>m : Symbol(m, Decl(commaOperatorInConditionalExpression.ts, 0, 12)) +>i : Symbol(i, Decl(commaOperatorInConditionalExpression.ts, 1, 18)) + + }) +} diff --git a/tests/baselines/reference/commaOperatorInConditionalExpression.types b/tests/baselines/reference/commaOperatorInConditionalExpression.types new file mode 100644 index 00000000000..f46282f9b6b --- /dev/null +++ b/tests/baselines/reference/commaOperatorInConditionalExpression.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/commaOperatorInConditionalExpression.ts === +function f (m: string) { +>f : (m: string) => void +>m : string + + [1, 2, 3].map(i => { +>[1, 2, 3].map(i => { return true? { [m]: i } : { [m]: i + 1 } }) : { [x: string]: number; }[] +>[1, 2, 3].map : { (this: [number, number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U]; (this: [number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U]; (this: [number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; } +>[1, 2, 3] : number[] +>1 : 1 +>2 : 2 +>3 : 3 +>map : { (this: [number, number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U]; (this: [number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U]; (this: [number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; } +>i => { return true? { [m]: i } : { [m]: i + 1 } } : (i: number) => { [x: string]: number; } +>i : number + + return true? { [m]: i } : { [m]: i + 1 } +>true? { [m]: i } : { [m]: i + 1 } : { [x: string]: number; } +>true : true +>{ [m]: i } : { [x: string]: number; } +>m : string +>i : number +>{ [m]: i + 1 } : { [x: string]: number; } +>m : string +>i + 1 : number +>i : number +>1 : 1 + + }) +} diff --git a/tests/cases/compiler/commaOperatorInConditionalExpression.ts b/tests/cases/compiler/commaOperatorInConditionalExpression.ts new file mode 100644 index 00000000000..a65d8ba1882 --- /dev/null +++ b/tests/cases/compiler/commaOperatorInConditionalExpression.ts @@ -0,0 +1,5 @@ +function f (m: string) { + [1, 2, 3].map(i => { + return true? { [m]: i } : { [m]: i + 1 } + }) +} \ No newline at end of file From 1710df5f28fed8dfa7630978c873ed1bf6ee3983 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 12:56:32 -0800 Subject: [PATCH 28/41] Type of for-in variable is keyof T when object type is a type parameter --- src/compiler/checker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3c8c0be77c7..89daf7ea0cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3216,11 +3216,11 @@ namespace ts { } } - // 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 === SyntaxKind.ForInStatement) { - // const indexType = getIndexType(checkNonNullExpression((declaration.parent.parent).expression)); - // return indexType.flags & TypeFlags.Index ? indexType : stringType; - return stringType; + const indexType = getIndexType(checkNonNullExpression((declaration.parent.parent).expression)); + return indexType.flags & TypeFlags.Index ? indexType : stringType; } if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { From dbc661f88e62ce06c44a6b67b13da40dbf668d10 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 12:57:43 -0800 Subject: [PATCH 29/41] Accept new baselines --- tests/baselines/reference/for-inStatements.errors.txt | 8 +++++++- .../reference/for-inStatementsInvalid.errors.txt | 8 +++++++- tests/baselines/reference/forInStatement3.types | 2 +- tests/baselines/reference/implicitAnyInCatch.types | 2 +- tests/baselines/reference/inOperatorWithGeneric.types | 2 +- .../reference/parserES5ForOfStatement19.errors.txt | 7 ------- .../baselines/reference/parserES5ForOfStatement19.symbols | 5 +++++ tests/baselines/reference/parserES5ForOfStatement19.types | 5 +++++ .../reference/parserES5ForOfStatement20.errors.txt | 7 ++----- .../baselines/reference/parserForOfStatement19.errors.txt | 7 ------- tests/baselines/reference/parserForOfStatement19.symbols | 5 +++++ tests/baselines/reference/parserForOfStatement19.types | 5 +++++ .../baselines/reference/parserForOfStatement20.errors.txt | 7 ++----- tests/baselines/reference/recursiveLetConst.errors.txt | 5 +---- 14 files changed, 42 insertions(+), 33 deletions(-) delete mode 100644 tests/baselines/reference/parserES5ForOfStatement19.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement19.symbols create mode 100644 tests/baselines/reference/parserES5ForOfStatement19.types delete mode 100644 tests/baselines/reference/parserForOfStatement19.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement19.symbols create mode 100644 tests/baselines/reference/parserForOfStatement19.types diff --git a/tests/baselines/reference/for-inStatements.errors.txt b/tests/baselines/reference/for-inStatements.errors.txt index f0e6c950ebb..c5ca29d2150 100644 --- a/tests/baselines/reference/for-inStatements.errors.txt +++ b/tests/baselines/reference/for-inStatements.errors.txt @@ -1,7 +1,9 @@ +tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,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/conformance/statements/for-inStatements/for-inStatements.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-inStatements/for-inStatements.ts (3 errors) ==== var aString: string; for (aString in {}) { } @@ -35,6 +37,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this.biz()) { } for (var x in this.biz) { } for (var x in this) { } + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. return null; } @@ -52,6 +56,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this.biz()) { } for (var x in this.biz) { } for (var x in this) { } + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.errors.txt b/tests/baselines/reference/for-inStatementsInvalid.errors.txt index 00ab58ab94d..f98349973a3 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.errors.txt +++ b/tests/baselines/reference/for-inStatementsInvalid.errors.txt @@ -9,13 +9,15 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(1 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(20,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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(22,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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(29,23): 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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(31,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(38,23): 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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(46,23): 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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(48,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(51,23): 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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(62,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/conformance/statements/for-inStatements/for-inStatementsInvalid.ts (15 errors) ==== +==== tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts (17 errors) ==== var aNumber: number; for (aNumber in {}) { } ~~~~~~~ @@ -69,6 +71,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 !!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in this.biz) { } for (var x in this) { } + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. return null; } @@ -90,6 +94,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 !!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. for (var x in this.biz) { } for (var x in this) { } + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/forInStatement3.types b/tests/baselines/reference/forInStatement3.types index d3767790ed2..09e6cf3ad96 100644 --- a/tests/baselines/reference/forInStatement3.types +++ b/tests/baselines/reference/forInStatement3.types @@ -8,7 +8,7 @@ function F() { >T : T for (var a in expr) { ->a : string +>a : keyof T >expr : T } } diff --git a/tests/baselines/reference/implicitAnyInCatch.types b/tests/baselines/reference/implicitAnyInCatch.types index d2a1be4a910..93cce09928e 100644 --- a/tests/baselines/reference/implicitAnyInCatch.types +++ b/tests/baselines/reference/implicitAnyInCatch.types @@ -22,7 +22,7 @@ class C { >temp : () => void for (var x in this) { ->x : string +>x : keyof this >this : this } } diff --git a/tests/baselines/reference/inOperatorWithGeneric.types b/tests/baselines/reference/inOperatorWithGeneric.types index facdb7b50e2..eba9bf1419b 100644 --- a/tests/baselines/reference/inOperatorWithGeneric.types +++ b/tests/baselines/reference/inOperatorWithGeneric.types @@ -9,7 +9,7 @@ class C { >T : T for (var p in x) { ->p : string +>p : keyof T >x : T } } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.errors.txt b/tests/baselines/reference/parserES5ForOfStatement19.errors.txt deleted file mode 100644 index 9d0bb02f1ef..00000000000 --- a/tests/baselines/reference/parserES5ForOfStatement19.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts(1,16): 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/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts (1 errors) ==== - for (var of in of) { } - ~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement19.symbols b/tests/baselines/reference/parserES5ForOfStatement19.symbols new file mode 100644 index 00000000000..93ba77e3db9 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === +for (var of in of) { } +>of : Symbol(of, Decl(parserES5ForOfStatement19.ts, 0, 8)) +>of : Symbol(of, Decl(parserES5ForOfStatement19.ts, 0, 8)) + diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types new file mode 100644 index 00000000000..13abc7ae757 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt index 2bfc54590ad..4aee32394b6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,20): 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/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== for (var of = 0 in of) { } ~~ -!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. - ~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement19.errors.txt b/tests/baselines/reference/parserForOfStatement19.errors.txt deleted file mode 100644 index a111498efe7..00000000000 --- a/tests/baselines/reference/parserForOfStatement19.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts(1,16): 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/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts (1 errors) ==== - for (var of in of) { } - ~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement19.symbols b/tests/baselines/reference/parserForOfStatement19.symbols new file mode 100644 index 00000000000..1e123349e13 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === +for (var of in of) { } +>of : Symbol(of, Decl(parserForOfStatement19.ts, 0, 8)) +>of : Symbol(of, Decl(parserForOfStatement19.ts, 0, 8)) + diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types new file mode 100644 index 00000000000..6fcc5e8f792 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement20.errors.txt b/tests/baselines/reference/parserForOfStatement20.errors.txt index f2b6ac39a83..461f307f6b9 100644 --- a/tests/baselines/reference/parserForOfStatement20.errors.txt +++ b/tests/baselines/reference/parserForOfStatement20.errors.txt @@ -1,10 +1,7 @@ tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,20): 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/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== for (var of = 0 in of) { } ~~ -!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. - ~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt index 6d3f15880bb..88ecb379e5e 100644 --- a/tests/baselines/reference/recursiveLetConst.errors.txt +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -5,14 +5,13 @@ tests/cases/compiler/recursiveLetConst.ts(5,14): error TS2448: Block-scoped vari tests/cases/compiler/recursiveLetConst.ts(6,14): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(7,1): error TS7027: Unreachable code detected. tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped variable 'v' used before its declaration. -tests/cases/compiler/recursiveLetConst.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/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped variable 'x2' used before its declaration. -==== tests/cases/compiler/recursiveLetConst.ts (12 errors) ==== +==== tests/cases/compiler/recursiveLetConst.ts (11 errors) ==== 'use strict' let x = x + 1; ~ @@ -36,8 +35,6 @@ tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped var !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let v in v) { } ~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. - ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let v of v) { } ~ From b662a8b31906558ec1bd90d8668e78042d2e567c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 21 Nov 2016 13:10:42 -0800 Subject: [PATCH 30/41] Add test case --- .../reference/keyofAndIndexedAccess.js | 12 +++ .../reference/keyofAndIndexedAccess.symbols | 92 +++++++++++-------- .../reference/keyofAndIndexedAccess.types | 23 +++++ .../types/keyof/keyofAndIndexedAccess.ts | 6 ++ 4 files changed, 97 insertions(+), 36 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 017669603a4..1cc8846bbbd 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -211,6 +211,12 @@ function f55(obj: T, key: K) { const b = "foo" in obj[key]; } +function f60(source: T, target: T) { + for (let k in source) { + target[k] = source[k]; + } +} + // Repros from #12011 class Base { @@ -383,6 +389,11 @@ function f55(obj, key) { } var b = "foo" in obj[key]; } +function f60(source, target) { + for (var k in source) { + target[k] = source[k]; + } +} // Repros from #12011 var Base = (function () { function Base() { @@ -518,6 +529,7 @@ declare function f53(obj: { }, k: K, s: string, n: number): void; 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 class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 8a2f1052d13..634dfe09da9 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -735,84 +735,104 @@ function f55(obj: T, key: K) { >key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 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)) + + for (let k in source) { +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 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)) + } +} + // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 215, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 215, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 215, 8)) +>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)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 215, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 221, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 218, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 218, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 218, 8)) +>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)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 218, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 218, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 224, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 224, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 223, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 229, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 225, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 231, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 210, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 217, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 225, 16)) +>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)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 228, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 234, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 221, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 214, 12)) +>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)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 234, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 240, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 236, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) setProperty(this, "parts", parts); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 236, 16)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 238, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 244, 5)) return getProperty(this, "parts") >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 232, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) } } diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 4c09909c0fd..916b82aaf40 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -854,6 +854,29 @@ function f55(obj: T, key: K) { >key : K } +function f60(source: T, target: T) { +>f60 : (source: T, target: T) => void +>T : T +>source : T +>T : T +>target : T +>T : T + + for (let k in source) { +>k : keyof T +>source : T + + target[k] = source[k]; +>target[k] = source[k] : T[keyof T] +>target[k] : T[keyof T] +>target : T +>k : keyof T +>source[k] : T[keyof T] +>source : T +>k : keyof T + } +} + // Repros from #12011 class Base { diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 690154cb7ac..b0451b8d55c 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -211,6 +211,12 @@ function f55(obj: T, key: K) { const b = "foo" in obj[key]; } +function f60(source: T, target: T) { + for (let k in source) { + target[k] = source[k]; + } +} + // Repros from #12011 class Base { From 9009da225c75bdb1d100b1f9bb2af6acae29863e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Nov 2016 17:25:31 -0800 Subject: [PATCH 31/41] Update baseline-accept configuration --- Jakefile.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 087bbb67511..24d1cc3c79e 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -1086,12 +1086,10 @@ task("tests-debug", ["setDebugMode", "tests"]); // Makes the test results the new baseline desc("Makes the most recent test results the new baseline, overwriting the old baseline"); task("baseline-accept", function () { - acceptBaseline(""); + acceptBaseline(localBaseline, refBaseline); }); -function acceptBaseline(containerFolder) { - var sourceFolder = path.join(localBaseline, containerFolder); - var targetFolder = path.join(refBaseline, containerFolder); +function acceptBaseline(sourceFolder, targetFolder) { console.log('Accept baselines from ' + sourceFolder + ' to ' + targetFolder); var files = fs.readdirSync(sourceFolder); var deleteEnding = '.delete'; @@ -1115,12 +1113,12 @@ function acceptBaseline(containerFolder) { desc("Makes the most recent rwc test results the new baseline, overwriting the old baseline"); task("baseline-accept-rwc", function () { - acceptBaseline("rwc"); + acceptBaseline(localRwcBaseline, refRwcBaseline); }); desc("Makes the most recent test262 test results the new baseline, overwriting the old baseline"); task("baseline-accept-test262", function () { - acceptBaseline("test262"); + acceptBaseline(localTest262Baseline, refTest262Baseline); }); From 843d08b5af6a31c2c3c92f57bfbe0abad6e53e77 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Nov 2016 17:25:38 -0800 Subject: [PATCH 32/41] increase timeout --- Jakefile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jakefile.js b/Jakefile.js index 24d1cc3c79e..3454ca8ae30 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -930,7 +930,7 @@ function runConsoleTests(defaultReporter, runInParallel) { } if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 400000; + testTimeout = 800000; } colors = process.env.colors || process.env.color; From 5403ce62ed0df80177d664c0ab77d6a62c672d28 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Nov 2016 17:26:10 -0800 Subject: [PATCH 33/41] normalize path in harness --- src/harness/harness.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 88346557ba7..26a4a6f963d 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -2015,7 +2015,7 @@ namespace Harness { export function isDefaultLibraryFile(filePath: string): boolean { // We need to make sure that the filePath is prefixed with "lib." not just containing "lib." and end with ".d.ts" - const fileName = ts.getBaseFileName(filePath); + const fileName = ts.getBaseFileName(ts.normalizeSlashes(filePath)); return ts.startsWith(fileName, "lib.") && ts.endsWith(fileName, ".d.ts"); } From b8b6e6149194e6c99b752de469334a676a91a975 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Nov 2016 17:26:18 -0800 Subject: [PATCH 34/41] handel missing files gracefully --- src/harness/rwcRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 9f9bf8589f0..44d2c981c84 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -199,7 +199,7 @@ namespace RWC { } // Do not include the library in the baselines to avoid noise const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName)); - const errors = compilerResult.errors.filter(e => !Harness.isDefaultLibraryFile(e.file.fileName)); + const errors = compilerResult.errors.filter(e => e.file && !Harness.isDefaultLibraryFile(e.file.fileName)); return Harness.Compiler.getErrorBaseline(baselineFiles, errors); }, baselineOpts); }); From 70e130b08cc884c76fb8e7fb09f6bd4799ee7cc2 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Mon, 21 Nov 2016 13:42:42 -0800 Subject: [PATCH 35/41] Maintain support for deprecated API typingOptions.enableAutoDiscovery --- src/compiler/commandLineParser.ts | 22 +++++++++- src/compiler/types.ts | 4 ++ .../convertTypeAcquisitionFromJson.ts | 41 +++++++++++++++---- src/server/protocol.ts | 4 ++ src/server/session.ts | 6 +++ 5 files changed, 67 insertions(+), 10 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d54af31a985..5e44efc4235 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -463,6 +463,13 @@ namespace ts { /* @internal */ export let typeAcquisitionDeclarations: CommandLineOption[] = [ + { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ + name: "enableAutoDiscovery", + type: "boolean", + }, { name: "enable", type: "boolean", @@ -501,6 +508,15 @@ namespace ts { let optionNameMapCache: OptionNameMap; + /* @internal */ + export function replaceEnableAutoDiscoveryWithEnable(typeAcquisition: TypeAcquisition): void { + // Replace deprecated typingOptions.enableAutoDiscovery with typeAcquisition.enable + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + typeAcquisition.enable = typeAcquisition.enableAutoDiscovery; + delete typeAcquisition.enableAutoDiscovery; + } + } + /* @internal */ export function getOptionNameMap(): OptionNameMap { if (optionNameMapCache) { @@ -843,7 +859,9 @@ namespace ts { } let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - const typeAcquisition: TypeAcquisition = convertTypeAcquisitionFromJsonWorker(json["typeAcquisition"], basePath, errors, configFileName); + // typingOptions has been deprecated. Use typeAcquisition instead. + const jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + const typeAcquisition: TypeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); if (json["extends"]) { let [include, exclude, files, baseOptions]: [string[], string[], string[], CompilerOptions] = [undefined, undefined, undefined, {}]; @@ -1016,7 +1034,9 @@ namespace ts { basePath: string, errors: Diagnostic[], configFileName?: string): TypeAcquisition { const options: TypeAcquisition = { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + replaceEnableAutoDiscoveryWithEnable(jsonOptions); convertOptionsFromJson(typeAcquisitionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors); + return options; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5cd5b15d653..9c45dd11107 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3199,6 +3199,10 @@ namespace ts { } export interface TypeAcquisition { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ + enableAutoDiscovery?: boolean; enable?: boolean; include?: string[]; exclude?: string[]; diff --git a/src/harness/unittests/convertTypeAcquisitionFromJson.ts b/src/harness/unittests/convertTypeAcquisitionFromJson.ts index a935c3c0e66..4c21b7ca2b9 100644 --- a/src/harness/unittests/convertTypeAcquisitionFromJson.ts +++ b/src/harness/unittests/convertTypeAcquisitionFromJson.ts @@ -4,7 +4,8 @@ namespace ts { describe("convertTypeAcquisitionFromJson", () => { function assertTypeAcquisition(json: any, configFileName: string, expectedResult: { typeAcquisition: TypeAcquisition, errors: Diagnostic[] }) { - const { options: actualTypeAcquisition, errors: actualErrors } = convertTypeAcquisitionFromJson(json["typeAcquisition"], "/apath/", configFileName); + const jsonOptions = json["typeAcquisition"] || json["typingOptions"]; + const { options: actualTypeAcquisition, errors: actualErrors } = convertTypeAcquisitionFromJson(jsonOptions, "/apath/", configFileName); const parsedTypeAcquisition = JSON.stringify(actualTypeAcquisition); const expectedTypeAcquisition = JSON.stringify(expectedResult.typeAcquisition); assert.equal(parsedTypeAcquisition, expectedTypeAcquisition); @@ -20,7 +21,29 @@ namespace ts { } // tsconfig.json - it("Convert correctly format tsconfig.json to typing-options ", () => { + it("Convert deprecated typingOptions.enableAutoDiscovery format tsconfig.json to typeAcquisition ", () => { + assertTypeAcquisition( + { + "typingOptions": + { + "enableAutoDiscovery": true, + "include": ["0.d.ts", "1.d.ts"], + "exclude": ["0.js", "1.js"] + } + }, + "tsconfig.json", + { + typeAcquisition: + { + enable: true, + include: ["0.d.ts", "1.d.ts"], + exclude: ["0.js", "1.js"] + }, + errors: [] + }); + }); + + it("Convert correctly format tsconfig.json to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": @@ -42,7 +65,7 @@ namespace ts { }); }); - it("Convert incorrect format tsconfig.json to typing-options ", () => { + it("Convert incorrect format tsconfig.json to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": @@ -70,7 +93,7 @@ namespace ts { }); }); - it("Convert default tsconfig.json to typing-options ", () => { + it("Convert default tsconfig.json to typeAcquisition ", () => { assertTypeAcquisition({}, "tsconfig.json", { typeAcquisition: @@ -83,7 +106,7 @@ namespace ts { }); }); - it("Convert tsconfig.json with only enable property to typing-options ", () => { + it("Convert tsconfig.json with only enable property to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": @@ -103,7 +126,7 @@ namespace ts { }); // jsconfig.json - it("Convert jsconfig.json to typing-options ", () => { + it("Convert jsconfig.json to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": @@ -124,7 +147,7 @@ namespace ts { }); }); - it("Convert default jsconfig.json to typing-options ", () => { + it("Convert default jsconfig.json to typeAcquisition ", () => { assertTypeAcquisition({ }, "jsconfig.json", { typeAcquisition: @@ -137,7 +160,7 @@ namespace ts { }); }); - it("Convert incorrect format jsconfig.json to typing-options ", () => { + it("Convert incorrect format jsconfig.json to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": @@ -165,7 +188,7 @@ namespace ts { }); }); - it("Convert jsconfig.json with only enable property to typing-options ", () => { + it("Convert jsconfig.json with only enable property to typeAcquisition ", () => { assertTypeAcquisition( { "typeAcquisition": diff --git a/src/server/protocol.ts b/src/server/protocol.ts index f25ed190c08..e1735f768e4 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -860,6 +860,10 @@ namespace ts.server.protocol { * Compiler options for the project */ options: ExternalProjectCompilerOptions; + /** + * @deprecated typingOptions. Use typeAcquisition instead + */ + typingOptions?: TypeAcquisition; /** * Explicitly specified type acquisition for the project */ diff --git a/src/server/session.ts b/src/server/session.ts index 36144b3212d..282964611e4 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1365,6 +1365,12 @@ namespace ts.server { private handlers = createMap<(request: protocol.Request) => { response?: any, responseRequired?: boolean }>({ [CommandNames.OpenExternalProject]: (request: protocol.OpenExternalProjectRequest) => { + // Replace deprecated typingOptions with typeAcquisition + if (request.arguments.typingOptions && !request.arguments.typeAcquisition) { + replaceEnableAutoDiscoveryWithEnable(request.arguments.typingOptions); + request.arguments.typeAcquisition = request.arguments.typingOptions; + delete request.arguments.typingOptions; + } this.projectService.openExternalProject(request.arguments); // TODO: report errors return this.requiredResponse(true); From ab8d6c0dab5e5114292dba0eb437628736fb1bf3 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 21 Nov 2016 22:45:36 -0800 Subject: [PATCH 36/41] Port lib changes --- src/lib/dom.generated.d.ts | 4286 +++++++---------- src/lib/webworker.generated.d.ts | 214 +- .../modularizeLibrary_Dom.iterable.symbols | 4 +- .../modularizeLibrary_Dom.iterable.types | 4 +- 4 files changed, 1822 insertions(+), 2686 deletions(-) diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index fd77f369fd8..d9825897ebc 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -76,6 +76,7 @@ interface DoubleRange { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -917,15 +918,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; @@ -936,14 +948,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; } @@ -996,17 +1001,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; } @@ -1128,16 +1137,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; } @@ -1838,7 +1851,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: { @@ -2163,6 +2175,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: { @@ -2291,7 +2305,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. */ @@ -2414,294 +2519,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; @@ -2710,14 +2815,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; /** @@ -2788,86 +2893,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 @@ -2969,7 +2995,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. @@ -3003,182 +3029,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; @@ -3249,103 +3100,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; } @@ -3355,7 +3110,6 @@ declare var Document: { } interface DocumentFragment extends Node, NodeSelector, ParentNode { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var DocumentFragment: { @@ -3370,7 +3124,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: { @@ -3423,6 +3176,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; @@ -3433,33 +3216,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; @@ -3467,188 +3250,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; @@ -3688,42 +3299,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; } @@ -3759,10 +3336,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; @@ -3823,6 +3402,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; } @@ -3993,6 +3573,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: { @@ -4065,6 +3647,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: { @@ -4131,6 +3715,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: { @@ -4155,6 +3741,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: { @@ -4167,6 +3755,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: { @@ -4183,6 +3773,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: { @@ -4199,6 +3791,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; } @@ -4207,6 +3800,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; @@ -4214,147 +3828,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; } @@ -4427,6 +3921,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: { @@ -4460,6 +3956,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: { @@ -4490,6 +3988,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: { @@ -4499,6 +3999,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: { @@ -4508,6 +4010,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: { @@ -4524,6 +4028,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: { @@ -4532,6 +4038,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: { @@ -4539,6 +4047,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; @@ -4557,73 +4135,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; @@ -4636,109 +4214,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; } @@ -4794,6 +4270,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; } @@ -4833,6 +4310,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: { @@ -4845,6 +4324,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; } @@ -4920,6 +4400,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; } @@ -4928,6 +4410,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. @@ -4980,7 +4466,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. */ @@ -4993,110 +4479,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; } @@ -5105,6 +4488,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; /** @@ -5124,152 +4526,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; } @@ -5291,6 +4575,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; } @@ -5301,6 +4586,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: { @@ -5313,6 +4600,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: { @@ -5325,6 +4614,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: { @@ -5332,6 +4623,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. @@ -5389,7 +4684,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. @@ -5407,110 +4702,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; } @@ -5601,6 +4793,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: { @@ -5812,6 +5006,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: { @@ -5825,6 +5021,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: { @@ -5841,6 +5039,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: { @@ -5857,6 +5057,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: { @@ -5900,6 +5102,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; } @@ -5917,6 +5120,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: { @@ -5924,6 +5129,12 @@ declare var HTMLMapElement: { new(): HTMLMapElement; } +interface HTMLMarqueeElementEventMap extends HTMLElementEventMap { + "bounce": Event; + "finish": Event; + "start": Event; +} + interface HTMLMarqueeElement extends HTMLElement { behavior: string; bgColor: any; @@ -5931,9 +5142,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; @@ -5941,112 +5152,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; } @@ -6055,6 +5161,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. @@ -6144,8 +5255,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. */ @@ -6223,111 +5334,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; } @@ -6348,6 +5355,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: { @@ -6380,6 +5389,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: { @@ -6394,6 +5405,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: { @@ -6410,6 +5423,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: { @@ -6424,6 +5439,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: { @@ -6543,6 +5560,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; } @@ -6581,6 +5599,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: { @@ -6618,6 +5638,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: { @@ -6644,6 +5666,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: { @@ -6668,6 +5692,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: { @@ -6676,6 +5702,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: { @@ -6688,6 +5716,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: { @@ -6712,6 +5742,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: { @@ -6724,6 +5756,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: { @@ -6762,6 +5796,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: { @@ -6856,6 +5892,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; } @@ -6880,6 +5918,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: { @@ -6888,6 +5928,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: { @@ -6905,6 +5947,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; } @@ -6922,6 +5965,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: { @@ -6975,6 +6020,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; } @@ -6996,6 +6042,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; } @@ -7116,6 +6163,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: { @@ -7167,6 +6216,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; } @@ -7194,6 +6244,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; } @@ -7204,6 +6255,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: { @@ -7309,6 +6362,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: { @@ -7321,6 +6376,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: { @@ -7340,6 +6397,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: { @@ -7354,6 +6413,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: { @@ -7362,6 +6423,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: { @@ -7369,6 +6432,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. @@ -7380,9 +6449,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. */ @@ -7409,114 +6478,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; } @@ -7584,11 +6546,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; @@ -7596,8 +6563,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; } @@ -7674,13 +6640,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; } @@ -7689,16 +6657,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; } @@ -7707,21 +6679,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; } @@ -7854,18 +6830,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; } @@ -8020,6 +7000,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: { @@ -8027,20 +7009,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; } @@ -8206,6 +7192,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; } @@ -8214,10 +7201,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; @@ -8229,8 +7221,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; } @@ -8267,12 +7258,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; } @@ -8422,13 +7417,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[]; @@ -8437,10 +7439,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; } @@ -8477,16 +7476,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; @@ -8496,10 +7502,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; } @@ -8540,12 +7543,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; } @@ -8723,7 +7730,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: { @@ -8898,10 +7904,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; } @@ -8910,15 +7920,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; } @@ -9297,9 +8311,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; @@ -9307,8 +8326,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; } @@ -9326,15 +8344,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; } @@ -9352,15 +8374,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; } @@ -9378,11 +8404,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; @@ -9393,8 +8424,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; } @@ -9412,8 +8442,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; @@ -9422,7 +8456,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; } @@ -9432,9 +8466,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; @@ -9442,8 +8481,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; } @@ -9453,10 +8491,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; } @@ -9531,6 +8573,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; } @@ -9687,6 +8730,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; } @@ -9697,6 +8741,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; } @@ -9719,6 +8764,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: { @@ -9733,6 +8780,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; } @@ -9742,6 +8790,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; } @@ -9750,67 +8799,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; } @@ -9850,6 +8867,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; } @@ -9879,6 +8897,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; } @@ -9913,6 +8932,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; } @@ -9928,6 +8948,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; } @@ -9951,6 +8972,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; } @@ -9983,6 +9005,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; } @@ -10001,6 +9024,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; } @@ -10020,6 +9044,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; } @@ -10036,6 +9061,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: { @@ -10044,6 +9071,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; } @@ -10089,6 +9117,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; } @@ -10099,6 +9128,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; } @@ -10108,6 +9138,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; } @@ -10118,6 +9149,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: { @@ -10133,6 +9166,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; } @@ -10148,6 +9182,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; } @@ -10160,6 +9195,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: { @@ -10174,6 +9211,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; } @@ -10191,6 +9229,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: { @@ -10200,6 +9240,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; } @@ -10221,6 +9262,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; } @@ -10245,6 +9287,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; } @@ -10258,6 +9301,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; } @@ -10267,6 +9311,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; } @@ -10283,6 +9328,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; } @@ -10301,6 +9347,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; } @@ -10366,6 +9413,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; } @@ -10402,6 +9450,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; } @@ -10423,6 +9472,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; } @@ -10457,6 +9507,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: { @@ -10512,6 +9564,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; } @@ -10804,6 +9857,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; } @@ -10840,6 +9894,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; } @@ -10849,6 +9904,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; } @@ -10927,6 +9983,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; } @@ -10935,18 +9992,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; @@ -10978,58 +10044,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; } @@ -11040,6 +10055,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; } @@ -11050,6 +10066,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; } @@ -11079,6 +10096,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; } @@ -11088,6 +10106,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; } @@ -11097,6 +10116,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; } @@ -11128,6 +10148,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; } @@ -11140,7 +10161,6 @@ declare var SVGTextContentElement: { } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextElement: { @@ -11158,7 +10178,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: { @@ -11186,6 +10205,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; } @@ -11257,6 +10277,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; } @@ -11267,6 +10288,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; } @@ -11298,6 +10320,10 @@ declare var SVGZoomEvent: { new(): SVGZoomEvent; } +interface ScreenEventMap { + "MSOrientationChange": Event; +} + interface Screen extends EventTarget { readonly availHeight: number; readonly availWidth: number; @@ -11310,14 +10336,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; } @@ -11336,10 +10362,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; } @@ -11521,6 +10551,7 @@ declare var SubtleCrypto: { interface Text extends CharacterData { readonly wholeText: string; + readonly assignedSlot: HTMLSlotElement | null; splitText(offset: number): Text; } @@ -11570,6 +10601,12 @@ declare var TextMetrics: { new(): TextMetrics; } +interface TextTrackEventMap { + "cuechange": Event; + "error": ErrorEvent; + "load": Event; +} + interface TextTrack extends EventTarget { readonly activeCues: TextTrackCueList; readonly cues: TextTrackCueList; @@ -11578,9 +10615,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; @@ -11591,9 +10628,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; } @@ -11609,18 +10644,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; } @@ -11641,11 +10680,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; } @@ -11835,17 +10878,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; } @@ -12791,14 +11838,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; @@ -12808,10 +11862,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; } @@ -12847,6 +11898,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; @@ -12871,97 +12011,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; @@ -13020,101 +12160,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; } @@ -13123,12 +12169,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; } @@ -13138,6 +12187,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: { @@ -13145,8 +12196,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; @@ -13174,14 +12229,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; } @@ -13197,6 +12245,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; } @@ -13217,7 +12266,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: { @@ -13226,7 +12275,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: { @@ -13296,9 +12345,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; } @@ -13409,25 +12462,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; } @@ -13454,25 +12511,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; } @@ -13521,359 +12582,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; } @@ -13973,21 +12684,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; } @@ -14247,6 +12962,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 { @@ -14294,6 +13036,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; }; @@ -14468,7 +13651,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; @@ -14495,101 +13677,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/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index 130510334d6..089d0bdc5d5 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -8,6 +8,7 @@ interface Algorithm { } interface EventInit { + scoped?: boolean; bubbles?: boolean; cancelable?: boolean; } @@ -242,10 +243,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; @@ -298,6 +301,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; } @@ -339,11 +343,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; @@ -351,8 +360,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; } @@ -429,13 +437,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; } @@ -444,16 +454,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; } @@ -462,21 +476,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; } @@ -533,18 +551,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; } @@ -584,6 +606,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; } @@ -627,12 +650,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; } @@ -680,14 +707,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; @@ -697,10 +731,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; } @@ -713,12 +744,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; } @@ -727,8 +761,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; @@ -755,14 +793,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; } @@ -778,6 +809,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; } @@ -786,31 +818,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; } @@ -838,21 +878,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; } @@ -868,15 +912,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; } @@ -904,7 +951,6 @@ declare var WorkerLocation: { interface WorkerNavigator extends Object, NavigatorID, NavigatorOnLine { readonly hardwareConcurrency: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var WorkerNavigator: { @@ -912,10 +958,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; } @@ -1176,7 +1226,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; @@ -1197,8 +1246,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/tests/baselines/reference/modularizeLibrary_Dom.iterable.symbols b/tests/baselines/reference/modularizeLibrary_Dom.iterable.symbols index a487763582b..478997ca630 100644 --- a/tests/baselines/reference/modularizeLibrary_Dom.iterable.symbols +++ b/tests/baselines/reference/modularizeLibrary_Dom.iterable.symbols @@ -2,9 +2,9 @@ for (const element of document.getElementsByTagName("a")) { >element : Symbol(element, Decl(modularizeLibrary_Dom.iterable.ts, 1, 10)) ->document.getElementsByTagName : Symbol(Document.getElementsByTagName, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>document.getElementsByTagName : Symbol(Document.getElementsByTagName, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) >document : Symbol(document, Decl(lib.dom.d.ts, --, --)) ->getElementsByTagName : Symbol(Document.getElementsByTagName, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>getElementsByTagName : Symbol(Document.getElementsByTagName, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) element.href; >element.href : Symbol(HTMLAnchorElement.href, Decl(lib.dom.d.ts, --, --)) diff --git a/tests/baselines/reference/modularizeLibrary_Dom.iterable.types b/tests/baselines/reference/modularizeLibrary_Dom.iterable.types index dbce5e17ae2..054923fb5ee 100644 --- a/tests/baselines/reference/modularizeLibrary_Dom.iterable.types +++ b/tests/baselines/reference/modularizeLibrary_Dom.iterable.types @@ -3,9 +3,9 @@ for (const element of document.getElementsByTagName("a")) { >element : HTMLAnchorElement >document.getElementsByTagName("a") : NodeListOf ->document.getElementsByTagName : { (tagname: "a"): NodeListOf; (tagname: "abbr"): NodeListOf; (tagname: "acronym"): NodeListOf; (tagname: "address"): NodeListOf; (tagname: "applet"): NodeListOf; (tagname: "area"): NodeListOf; (tagname: "article"): NodeListOf; (tagname: "aside"): NodeListOf; (tagname: "audio"): NodeListOf; (tagname: "b"): NodeListOf; (tagname: "base"): NodeListOf; (tagname: "basefont"): NodeListOf; (tagname: "bdo"): NodeListOf; (tagname: "big"): NodeListOf; (tagname: "blockquote"): NodeListOf; (tagname: "body"): NodeListOf; (tagname: "br"): NodeListOf; (tagname: "button"): NodeListOf; (tagname: "canvas"): NodeListOf; (tagname: "caption"): NodeListOf; (tagname: "center"): NodeListOf; (tagname: "circle"): NodeListOf; (tagname: "cite"): NodeListOf; (tagname: "clippath"): NodeListOf; (tagname: "code"): NodeListOf; (tagname: "col"): NodeListOf; (tagname: "colgroup"): NodeListOf; (tagname: "datalist"): NodeListOf; (tagname: "dd"): NodeListOf; (tagname: "defs"): NodeListOf; (tagname: "del"): NodeListOf; (tagname: "desc"): NodeListOf; (tagname: "dfn"): NodeListOf; (tagname: "dir"): NodeListOf; (tagname: "div"): NodeListOf; (tagname: "dl"): NodeListOf; (tagname: "dt"): NodeListOf; (tagname: "ellipse"): NodeListOf; (tagname: "em"): NodeListOf; (tagname: "embed"): NodeListOf; (tagname: "feblend"): NodeListOf; (tagname: "fecolormatrix"): NodeListOf; (tagname: "fecomponenttransfer"): NodeListOf; (tagname: "fecomposite"): NodeListOf; (tagname: "feconvolvematrix"): NodeListOf; (tagname: "fediffuselighting"): NodeListOf; (tagname: "fedisplacementmap"): NodeListOf; (tagname: "fedistantlight"): NodeListOf; (tagname: "feflood"): NodeListOf; (tagname: "fefunca"): NodeListOf; (tagname: "fefuncb"): NodeListOf; (tagname: "fefuncg"): NodeListOf; (tagname: "fefuncr"): NodeListOf; (tagname: "fegaussianblur"): NodeListOf; (tagname: "feimage"): NodeListOf; (tagname: "femerge"): NodeListOf; (tagname: "femergenode"): NodeListOf; (tagname: "femorphology"): NodeListOf; (tagname: "feoffset"): NodeListOf; (tagname: "fepointlight"): NodeListOf; (tagname: "fespecularlighting"): NodeListOf; (tagname: "fespotlight"): NodeListOf; (tagname: "fetile"): NodeListOf; (tagname: "feturbulence"): NodeListOf; (tagname: "fieldset"): NodeListOf; (tagname: "figcaption"): NodeListOf; (tagname: "figure"): NodeListOf; (tagname: "filter"): NodeListOf; (tagname: "font"): NodeListOf; (tagname: "footer"): NodeListOf; (tagname: "foreignobject"): NodeListOf; (tagname: "form"): NodeListOf; (tagname: "frame"): NodeListOf; (tagname: "frameset"): NodeListOf; (tagname: "g"): NodeListOf; (tagname: "h1"): NodeListOf; (tagname: "h2"): NodeListOf; (tagname: "h3"): NodeListOf; (tagname: "h4"): NodeListOf; (tagname: "h5"): NodeListOf; (tagname: "h6"): NodeListOf; (tagname: "head"): NodeListOf; (tagname: "header"): NodeListOf; (tagname: "hgroup"): NodeListOf; (tagname: "hr"): NodeListOf; (tagname: "html"): NodeListOf; (tagname: "i"): NodeListOf; (tagname: "iframe"): NodeListOf; (tagname: "image"): NodeListOf; (tagname: "img"): NodeListOf; (tagname: "input"): NodeListOf; (tagname: "ins"): NodeListOf; (tagname: "isindex"): NodeListOf; (tagname: "kbd"): NodeListOf; (tagname: "keygen"): NodeListOf; (tagname: "label"): NodeListOf; (tagname: "legend"): NodeListOf; (tagname: "li"): NodeListOf; (tagname: "line"): NodeListOf; (tagname: "lineargradient"): NodeListOf; (tagname: "link"): NodeListOf; (tagname: "listing"): NodeListOf; (tagname: "map"): NodeListOf; (tagname: "mark"): NodeListOf; (tagname: "marker"): NodeListOf; (tagname: "marquee"): NodeListOf; (tagname: "mask"): NodeListOf; (tagname: "menu"): NodeListOf; (tagname: "meta"): NodeListOf; (tagname: "metadata"): NodeListOf; (tagname: "meter"): NodeListOf; (tagname: "nav"): NodeListOf; (tagname: "nextid"): NodeListOf; (tagname: "nobr"): NodeListOf; (tagname: "noframes"): NodeListOf; (tagname: "noscript"): NodeListOf; (tagname: "object"): NodeListOf; (tagname: "ol"): NodeListOf; (tagname: "optgroup"): NodeListOf; (tagname: "option"): NodeListOf; (tagname: "p"): NodeListOf; (tagname: "param"): NodeListOf; (tagname: "path"): NodeListOf; (tagname: "pattern"): NodeListOf; (tagname: "picture"): NodeListOf; (tagname: "plaintext"): NodeListOf; (tagname: "polygon"): NodeListOf; (tagname: "polyline"): NodeListOf; (tagname: "pre"): NodeListOf; (tagname: "progress"): NodeListOf; (tagname: "q"): NodeListOf; (tagname: "radialgradient"): NodeListOf; (tagname: "rect"): NodeListOf; (tagname: "rt"): NodeListOf; (tagname: "ruby"): NodeListOf; (tagname: "s"): NodeListOf; (tagname: "samp"): NodeListOf; (tagname: "script"): NodeListOf; (tagname: "section"): NodeListOf; (tagname: "select"): NodeListOf; (tagname: "small"): NodeListOf; (tagname: "source"): NodeListOf; (tagname: "span"): NodeListOf; (tagname: "stop"): NodeListOf; (tagname: "strike"): NodeListOf; (tagname: "strong"): NodeListOf; (tagname: "style"): NodeListOf; (tagname: "sub"): NodeListOf; (tagname: "sup"): NodeListOf; (tagname: "svg"): NodeListOf; (tagname: "switch"): NodeListOf; (tagname: "symbol"): NodeListOf; (tagname: "table"): NodeListOf; (tagname: "tbody"): NodeListOf; (tagname: "td"): NodeListOf; (tagname: "template"): NodeListOf; (tagname: "text"): NodeListOf; (tagname: "textpath"): NodeListOf; (tagname: "textarea"): NodeListOf; (tagname: "tfoot"): NodeListOf; (tagname: "th"): NodeListOf; (tagname: "thead"): NodeListOf; (tagname: "title"): NodeListOf; (tagname: "tr"): NodeListOf; (tagname: "track"): NodeListOf; (tagname: "tspan"): NodeListOf; (tagname: "tt"): NodeListOf; (tagname: "u"): NodeListOf; (tagname: "ul"): NodeListOf; (tagname: "use"): NodeListOf; (tagname: "var"): NodeListOf; (tagname: "video"): NodeListOf; (tagname: "view"): NodeListOf; (tagname: "wbr"): NodeListOf; (tagname: "x-ms-webview"): NodeListOf; (tagname: "xmp"): NodeListOf; (tagname: string): NodeListOf; } +>document.getElementsByTagName : { (tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf; } >document : Document ->getElementsByTagName : { (tagname: "a"): NodeListOf; (tagname: "abbr"): NodeListOf; (tagname: "acronym"): NodeListOf; (tagname: "address"): NodeListOf; (tagname: "applet"): NodeListOf; (tagname: "area"): NodeListOf; (tagname: "article"): NodeListOf; (tagname: "aside"): NodeListOf; (tagname: "audio"): NodeListOf; (tagname: "b"): NodeListOf; (tagname: "base"): NodeListOf; (tagname: "basefont"): NodeListOf; (tagname: "bdo"): NodeListOf; (tagname: "big"): NodeListOf; (tagname: "blockquote"): NodeListOf; (tagname: "body"): NodeListOf; (tagname: "br"): NodeListOf; (tagname: "button"): NodeListOf; (tagname: "canvas"): NodeListOf; (tagname: "caption"): NodeListOf; (tagname: "center"): NodeListOf; (tagname: "circle"): NodeListOf; (tagname: "cite"): NodeListOf; (tagname: "clippath"): NodeListOf; (tagname: "code"): NodeListOf; (tagname: "col"): NodeListOf; (tagname: "colgroup"): NodeListOf; (tagname: "datalist"): NodeListOf; (tagname: "dd"): NodeListOf; (tagname: "defs"): NodeListOf; (tagname: "del"): NodeListOf; (tagname: "desc"): NodeListOf; (tagname: "dfn"): NodeListOf; (tagname: "dir"): NodeListOf; (tagname: "div"): NodeListOf; (tagname: "dl"): NodeListOf; (tagname: "dt"): NodeListOf; (tagname: "ellipse"): NodeListOf; (tagname: "em"): NodeListOf; (tagname: "embed"): NodeListOf; (tagname: "feblend"): NodeListOf; (tagname: "fecolormatrix"): NodeListOf; (tagname: "fecomponenttransfer"): NodeListOf; (tagname: "fecomposite"): NodeListOf; (tagname: "feconvolvematrix"): NodeListOf; (tagname: "fediffuselighting"): NodeListOf; (tagname: "fedisplacementmap"): NodeListOf; (tagname: "fedistantlight"): NodeListOf; (tagname: "feflood"): NodeListOf; (tagname: "fefunca"): NodeListOf; (tagname: "fefuncb"): NodeListOf; (tagname: "fefuncg"): NodeListOf; (tagname: "fefuncr"): NodeListOf; (tagname: "fegaussianblur"): NodeListOf; (tagname: "feimage"): NodeListOf; (tagname: "femerge"): NodeListOf; (tagname: "femergenode"): NodeListOf; (tagname: "femorphology"): NodeListOf; (tagname: "feoffset"): NodeListOf; (tagname: "fepointlight"): NodeListOf; (tagname: "fespecularlighting"): NodeListOf; (tagname: "fespotlight"): NodeListOf; (tagname: "fetile"): NodeListOf; (tagname: "feturbulence"): NodeListOf; (tagname: "fieldset"): NodeListOf; (tagname: "figcaption"): NodeListOf; (tagname: "figure"): NodeListOf; (tagname: "filter"): NodeListOf; (tagname: "font"): NodeListOf; (tagname: "footer"): NodeListOf; (tagname: "foreignobject"): NodeListOf; (tagname: "form"): NodeListOf; (tagname: "frame"): NodeListOf; (tagname: "frameset"): NodeListOf; (tagname: "g"): NodeListOf; (tagname: "h1"): NodeListOf; (tagname: "h2"): NodeListOf; (tagname: "h3"): NodeListOf; (tagname: "h4"): NodeListOf; (tagname: "h5"): NodeListOf; (tagname: "h6"): NodeListOf; (tagname: "head"): NodeListOf; (tagname: "header"): NodeListOf; (tagname: "hgroup"): NodeListOf; (tagname: "hr"): NodeListOf; (tagname: "html"): NodeListOf; (tagname: "i"): NodeListOf; (tagname: "iframe"): NodeListOf; (tagname: "image"): NodeListOf; (tagname: "img"): NodeListOf; (tagname: "input"): NodeListOf; (tagname: "ins"): NodeListOf; (tagname: "isindex"): NodeListOf; (tagname: "kbd"): NodeListOf; (tagname: "keygen"): NodeListOf; (tagname: "label"): NodeListOf; (tagname: "legend"): NodeListOf; (tagname: "li"): NodeListOf; (tagname: "line"): NodeListOf; (tagname: "lineargradient"): NodeListOf; (tagname: "link"): NodeListOf; (tagname: "listing"): NodeListOf; (tagname: "map"): NodeListOf; (tagname: "mark"): NodeListOf; (tagname: "marker"): NodeListOf; (tagname: "marquee"): NodeListOf; (tagname: "mask"): NodeListOf; (tagname: "menu"): NodeListOf; (tagname: "meta"): NodeListOf; (tagname: "metadata"): NodeListOf; (tagname: "meter"): NodeListOf; (tagname: "nav"): NodeListOf; (tagname: "nextid"): NodeListOf; (tagname: "nobr"): NodeListOf; (tagname: "noframes"): NodeListOf; (tagname: "noscript"): NodeListOf; (tagname: "object"): NodeListOf; (tagname: "ol"): NodeListOf; (tagname: "optgroup"): NodeListOf; (tagname: "option"): NodeListOf; (tagname: "p"): NodeListOf; (tagname: "param"): NodeListOf; (tagname: "path"): NodeListOf; (tagname: "pattern"): NodeListOf; (tagname: "picture"): NodeListOf; (tagname: "plaintext"): NodeListOf; (tagname: "polygon"): NodeListOf; (tagname: "polyline"): NodeListOf; (tagname: "pre"): NodeListOf; (tagname: "progress"): NodeListOf; (tagname: "q"): NodeListOf; (tagname: "radialgradient"): NodeListOf; (tagname: "rect"): NodeListOf; (tagname: "rt"): NodeListOf; (tagname: "ruby"): NodeListOf; (tagname: "s"): NodeListOf; (tagname: "samp"): NodeListOf; (tagname: "script"): NodeListOf; (tagname: "section"): NodeListOf; (tagname: "select"): NodeListOf; (tagname: "small"): NodeListOf; (tagname: "source"): NodeListOf; (tagname: "span"): NodeListOf; (tagname: "stop"): NodeListOf; (tagname: "strike"): NodeListOf; (tagname: "strong"): NodeListOf; (tagname: "style"): NodeListOf; (tagname: "sub"): NodeListOf; (tagname: "sup"): NodeListOf; (tagname: "svg"): NodeListOf; (tagname: "switch"): NodeListOf; (tagname: "symbol"): NodeListOf; (tagname: "table"): NodeListOf; (tagname: "tbody"): NodeListOf; (tagname: "td"): NodeListOf; (tagname: "template"): NodeListOf; (tagname: "text"): NodeListOf; (tagname: "textpath"): NodeListOf; (tagname: "textarea"): NodeListOf; (tagname: "tfoot"): NodeListOf; (tagname: "th"): NodeListOf; (tagname: "thead"): NodeListOf; (tagname: "title"): NodeListOf; (tagname: "tr"): NodeListOf; (tagname: "track"): NodeListOf; (tagname: "tspan"): NodeListOf; (tagname: "tt"): NodeListOf; (tagname: "u"): NodeListOf; (tagname: "ul"): NodeListOf; (tagname: "use"): NodeListOf; (tagname: "var"): NodeListOf; (tagname: "video"): NodeListOf; (tagname: "view"): NodeListOf; (tagname: "wbr"): NodeListOf; (tagname: "x-ms-webview"): NodeListOf; (tagname: "xmp"): NodeListOf; (tagname: string): NodeListOf; } +>getElementsByTagName : { (tagname: K): ElementListTagNameMap[K]; (tagname: string): NodeListOf; } >"a" : "a" element.href; From 6a5682c4a3c81382f684029f840cc0e7df6b8a83 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 22 Nov 2016 10:52:47 -0800 Subject: [PATCH 37/41] Support JSDoc @augments tag Fixes #12428 --- src/compiler/checker.ts | 12 +++++++++++- src/compiler/parser.ts | 15 +++++++++++++++ src/compiler/types.ts | 6 ++++++ src/compiler/utilities.ts | 4 ++++ tests/cases/fourslash/jsDocAugments.ts | 23 +++++++++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/jsDocAugments.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7f2c85d7a0d..7a361b09869 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3796,6 +3796,16 @@ namespace ts { } baseType = getReturnTypeOfSignature(constructors[0]); } + + // In a JS file, you can use the @augments jsdoc tag to specify a base type with type parameters + const valueDecl = type.symbol.valueDeclaration; + if (valueDecl && isInJavaScriptFile(valueDecl)) { + const augTag = getJSDocAugmentsTag(type.symbol.valueDeclaration); + if (augTag) { + baseType = getTypeFromTypeNode(augTag.typeExpression.type); + } + } + if (baseType === unknownType) { return; } @@ -3804,7 +3814,7 @@ namespace ts { return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, + error(valueDecl, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType)); return; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d286a9d9dac..0ce21b2d9fe 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -418,6 +418,8 @@ namespace ts { return visitNode(cbNode, (node).typeExpression); case SyntaxKind.JSDocTypeTag: return visitNode(cbNode, (node).typeExpression); + case SyntaxKind.JSDocAugmentsTag: + return visitNode(cbNode, (node).typeExpression); case SyntaxKind.JSDocTemplateTag: return visitNodes(cbNodes, (node).typeParameters); case SyntaxKind.JSDocTypedefTag: @@ -6426,6 +6428,9 @@ namespace ts { let tag: JSDocTag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": tag = parseParamTag(atToken, tagName); break; @@ -6642,6 +6647,16 @@ namespace ts { return finishNode(result); } + function parseAugmentsTag(atToken: AtToken, tagName: Identifier): JSDocAugmentsTag { + const typeExpression = tryParseTypeExpression(); + + const result = createNode(SyntaxKind.JSDocAugmentsTag, atToken.pos); + result.atToken = atToken; + result.tagName = tagName; + result.typeExpression = typeExpression; + return finishNode(result); + } + function parseTypedefTag(atToken: AtToken, tagName: Identifier): JSDocTypedefTag { const typeExpression = tryParseTypeExpression(); skipWhitespace(); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2cbace563a0..176176370e0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -349,6 +349,7 @@ namespace ts { JSDocThisType, JSDocComment, JSDocTag, + JSDocAugmentsTag, JSDocParameterTag, JSDocReturnTag, JSDocTypeTag, @@ -1989,6 +1990,11 @@ namespace ts { kind: SyntaxKind.JSDocTag; } + export interface JSDocAugmentsTag extends JSDocTag { + kind: SyntaxKind.JSDocAugmentsTag; + typeExpression: JSDocTypeExpression; + } + export interface JSDocTemplateTag extends JSDocTag { kind: SyntaxKind.JSDocTemplateTag; typeParameters: NodeArray; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e313f983fad..363ddf0de80 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1539,6 +1539,10 @@ namespace ts { return tag && tag.typeExpression && tag.typeExpression.type; } + export function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag { + return getFirstJSDocTag(node, SyntaxKind.JSDocAugmentsTag) as JSDocAugmentsTag; + } + export function getJSDocReturnTag(node: Node): JSDocReturnTag { return getFirstJSDocTag(node, SyntaxKind.JSDocReturnTag) as JSDocReturnTag; } diff --git a/tests/cases/fourslash/jsDocAugments.ts b/tests/cases/fourslash/jsDocAugments.ts new file mode 100644 index 00000000000..24458c529fb --- /dev/null +++ b/tests/cases/fourslash/jsDocAugments.ts @@ -0,0 +1,23 @@ +/// + +// @allowJs: true +// @Filename: dummy.js + +//// /** +//// * @augments {Thing} +//// */ +//// class MyStringThing extends Thing { +//// constructor() { +//// var x = this.mine; +//// x/**/; +//// } +//// } + +// @Filename: declarations.d.ts +//// declare class Thing { +//// mine: T; +//// } + +goTo.marker(); +verify.quickInfoIs("(local var) x: string"); + From 103090b60ecd2a09f19880cdb5d8c5d4bf9abc18 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Tue, 22 Nov 2016 10:56:46 -0800 Subject: [PATCH 38/41] report config errors when config file changed (#12372) --- .../unittests/tsserverProjectSystem.ts | 37 +++++++++++++++++++ src/server/editorServices.ts | 12 ++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index e9b6ccb7884..bf7be965b50 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2452,6 +2452,43 @@ namespace ts.projectSystem { openFilesForSession([file], session); serverEventManager.checkEventCountOfType("configFileDiag", 1); }); + + it("are generated when the config file changes", () => { + const serverEventManager = new TestServerEventManager(); + const file = { + path: "/a/b/app.ts", + content: "let x = 10" + }; + const configFile = { + path: "/a/b/tsconfig.json", + content: `{ + "compilerOptions": {} + }` + }; + + const host = createServerHost([file, configFile]); + const session = createSession(host, /*typingsInstaller*/ undefined, serverEventManager.handler); + openFilesForSession([file], session); + serverEventManager.checkEventCountOfType("configFileDiag", 1); + + configFile.content = `{ + "compilerOptions": { + "haha": 123 + } + }`; + host.reloadFS([file, configFile]); + host.triggerFileWatcherCallback(configFile.path); + host.runQueuedTimeoutCallbacks(); + serverEventManager.checkEventCountOfType("configFileDiag", 2); + + configFile.content = `{ + "compilerOptions": {} + }`; + host.reloadFS([file, configFile]); + host.triggerFileWatcherCallback(configFile.path); + host.runQueuedTimeoutCallbacks(); + serverEventManager.checkEventCountOfType("configFileDiag", 3); + }); }); describe("skipLibCheck", () => { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6a7cb049296..2a0e78eaccc 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -520,8 +520,10 @@ namespace ts.server { } private onConfigChangedForConfiguredProject(project: ConfiguredProject) { - this.logger.info(`Config file changed: ${project.getConfigFilePath()}`); - this.updateConfiguredProject(project); + const configFileName = project.getConfigFilePath(); + this.logger.info(`Config file changed: ${configFileName}`); + const configFileErrors = this.updateConfiguredProject(project); + this.reportConfigFileDiagnostics(configFileName, configFileErrors, /*triggerFile*/ configFileName); this.refreshInferredProjects(); } @@ -1015,6 +1017,9 @@ namespace ts.server { return; } + // note: the returned "success" is true does not mean the "configFileErrors" is empty. + // because we might have tolerated the errors and kept going. So always return the configFileErrors + // regardless the "success" here is true or not. const { success, projectOptions, configFileErrors } = this.convertConfigFileContentToProjectOptions(project.getConfigFilePath()); if (!success) { // reset project settings to default @@ -1026,7 +1031,7 @@ namespace ts.server { project.setCompilerOptions(projectOptions.compilerOptions); if (!project.languageServiceEnabled) { // language service is already disabled - return; + return configFileErrors; } project.disableLanguageService(); project.stopWatchingDirectory(); @@ -1038,6 +1043,7 @@ namespace ts.server { this.watchConfigDirectoryForProject(project, projectOptions); this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typingOptions, projectOptions.compileOnSave, configFileErrors); } + return configFileErrors; } createInferredProjectWithRootFileIfNecessary(root: ScriptInfo) { From 61204cc05df0e6cab10ccebea0193f36adfe9164 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Tue, 22 Nov 2016 14:17:59 -0600 Subject: [PATCH 39/41] Re-add sourceFiles to program emit callback Addresses https://github.com/Microsoft/TypeScript/issues/12444. --- src/compiler/emitter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index ed7f3ee16a0..90738d828be 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -143,7 +143,7 @@ namespace ts { // Write the source map if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false); + writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } // Record source map data for the test harness. @@ -152,7 +152,7 @@ namespace ts { } // Write the output file - writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM); + writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), compilerOptions.emitBOM, sourceFiles); // Reset state sourceMap.reset(); From 680fb2ea1b745105adadc908e9b1449c71e37978 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 22 Nov 2016 14:56:18 -0800 Subject: [PATCH 40/41] add typings installer user agent for npm requests (#12446) * add typings installer user agent for npm requests * address PR feedback: change name of user agent --- src/server/typingsInstaller/nodeTypingsInstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index bdfdda3033c..235c2f16dad 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -127,7 +127,7 @@ namespace ts.server.typingsInstaller { if (this.log.isEnabled()) { this.log.writeLine(`#${requestId} with arguments'${JSON.stringify(args)}'.`); } - const command = `${this.npmPath} install ${args.join(" ")} --save-dev`; + const command = `${this.npmPath} install ${args.join(" ")} --save-dev --user-agent="typesInstaller/${version}"`; const start = Date.now(); let stdout: Buffer; let stderr: Buffer; From 2b89d919a0de7167d45a377f69b13c977f4aa94d Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Tue, 22 Nov 2016 14:47:44 -0800 Subject: [PATCH 41/41] Addressing CR feedback --- src/compiler/commandLineParser.ts | 20 +++++++++++++------- src/server/editorServices.ts | 6 ++++++ src/server/session.ts | 6 ------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 5e44efc4235..414e1f117f5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -509,12 +509,17 @@ namespace ts { let optionNameMapCache: OptionNameMap; /* @internal */ - export function replaceEnableAutoDiscoveryWithEnable(typeAcquisition: TypeAcquisition): void { - // Replace deprecated typingOptions.enableAutoDiscovery with typeAcquisition.enable + export function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition { + // Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { - typeAcquisition.enable = typeAcquisition.enableAutoDiscovery; - delete typeAcquisition.enableAutoDiscovery; + const result: TypeAcquisition = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; } + return typeAcquisition; } /* @internal */ @@ -859,7 +864,8 @@ namespace ts { } let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - // typingOptions has been deprecated. Use typeAcquisition instead. + // typingOptions has been deprecated and is only supported for backward compatibility purposes. + // It should be removed in future releases - use typeAcquisition instead. const jsonOptions = json["typeAcquisition"] || json["typingOptions"]; const typeAcquisition: TypeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); @@ -1034,8 +1040,8 @@ namespace ts { basePath: string, errors: Diagnostic[], configFileName?: string): TypeAcquisition { const options: TypeAcquisition = { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - replaceEnableAutoDiscoveryWithEnable(jsonOptions); - convertOptionsFromJson(typeAcquisitionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors); + const typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(typeAcquisitionDeclarations, typeAcquisition, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors); return options; } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 49111d4a67f..5f65140c6dc 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1316,6 +1316,12 @@ namespace ts.server { } openExternalProject(proj: protocol.ExternalProject): 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) { + const typeAcquisition = convertEnableAutoDiscoveryToEnable(proj.typingOptions); + proj.typeAcquisition = typeAcquisition; + } let tsConfigFiles: NormalizedPath[]; const rootFiles: protocol.ExternalFile[] = []; for (const file of proj.rootFiles) { diff --git a/src/server/session.ts b/src/server/session.ts index 282964611e4..36144b3212d 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1365,12 +1365,6 @@ namespace ts.server { private handlers = createMap<(request: protocol.Request) => { response?: any, responseRequired?: boolean }>({ [CommandNames.OpenExternalProject]: (request: protocol.OpenExternalProjectRequest) => { - // Replace deprecated typingOptions with typeAcquisition - if (request.arguments.typingOptions && !request.arguments.typeAcquisition) { - replaceEnableAutoDiscoveryWithEnable(request.arguments.typingOptions); - request.arguments.typeAcquisition = request.arguments.typingOptions; - delete request.arguments.typingOptions; - } this.projectService.openExternalProject(request.arguments); // TODO: report errors return this.requiredResponse(true);