Merge pull request #1349 from Microsoft/propertyAssignments

Property assignments
This commit is contained in:
CyrusNajmabadi
2014-12-03 19:57:08 -08:00
69 changed files with 858 additions and 808 deletions
+6 -1
View File
@@ -411,7 +411,12 @@ module ts {
bindDeclaration(<Declaration>node, SymbolFlags.ConstructSignature, 0, /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.Method:
bindDeclaration(<Declaration>node, SymbolFlags.Method, SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
bindDeclaration(<Declaration>node, SymbolFlags.Method,
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.IndexSignature:
bindDeclaration(<Declaration>node, SymbolFlags.IndexSignature, 0, /*isBlockScopeContainer*/ false);
+122 -70
View File
@@ -2839,7 +2839,7 @@ module ts {
// The expression is processed as an identifier expression (section 4.3)
// or property access expression(section 4.10),
// the widened type(section 3.9) of which becomes the result.
links.resolvedType = getWidenedType(checkExpression(node.exprName));
links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName));
}
return links.resolvedType;
}
@@ -3240,26 +3240,35 @@ module ts {
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitiveExpression(node: Expression): boolean {
function isContextSensitive(node: Expression | MethodDeclaration | ObjectLiteralElement): boolean {
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
switch (node.kind) {
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
return !(<FunctionExpression>node).typeParameters && !forEach((<FunctionExpression>node).parameters, p => p.type);
return isContextSensitiveFunctionLikeDeclaration(<FunctionExpression>node);
case SyntaxKind.ObjectLiteralExpression:
return forEach((<ObjectLiteralExpression>node).properties, p =>
p.kind === SyntaxKind.PropertyAssignment && isContextSensitiveExpression((<PropertyDeclaration>p).initializer));
return forEach((<ObjectLiteralExpression>node).properties, isContextSensitive);
case SyntaxKind.ArrayLiteralExpression:
return forEach((<ArrayLiteralExpression>node).elements, e => isContextSensitiveExpression(e));
return forEach((<ArrayLiteralExpression>node).elements, isContextSensitive);
case SyntaxKind.ConditionalExpression:
return isContextSensitiveExpression((<ConditionalExpression>node).whenTrue) ||
isContextSensitiveExpression((<ConditionalExpression>node).whenFalse);
return isContextSensitive((<ConditionalExpression>node).whenTrue) ||
isContextSensitive((<ConditionalExpression>node).whenFalse);
case SyntaxKind.BinaryExpression:
return (<BinaryExpression>node).operator === SyntaxKind.BarBarToken &&
(isContextSensitiveExpression((<BinaryExpression>node).left) || isContextSensitiveExpression((<BinaryExpression>node).right));
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
case SyntaxKind.PropertyAssignment:
return isContextSensitive((<PropertyAssignment>node).initializer);
case SyntaxKind.Method:
return isContextSensitiveFunctionLikeDeclaration(<MethodDeclaration>node);
}
return false;
}
function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration) {
return !node.typeParameters && !forEach(node.parameters, p => p.type);
}
function getTypeWithoutConstructors(type: Type): Type {
if (type.flags & TypeFlags.ObjectType) {
var resolved = resolveObjectOrUnionTypeMembers(<ObjectType>type);
@@ -4750,7 +4759,7 @@ module ts {
function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type {
if (isFunctionExpressionOrArrowFunction(parameter.parent)) {
var func = <FunctionExpression>parameter.parent;
if (isContextSensitiveExpression(func)) {
if (isContextSensitive(func)) {
var contextualSignature = getContextualSignature(func);
if (contextualSignature) {
@@ -4890,12 +4899,21 @@ module ts {
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
function getContextualTypeForPropertyExpression(node: Expression): Type {
var declaration = <PropertyDeclaration>node.parent;
var objectLiteral = <ObjectLiteralExpression>declaration.parent;
function getContextualTypeForObjectLiteralMethod(node: MethodDeclaration): Type {
Debug.assert(isObjectLiteralMethod(node));
if (isInsideWithStatementBody(node)) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
return getContextualTypeForObjectLiteralElement(node);
}
function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) {
var objectLiteral = <ObjectLiteralExpression>element.parent;
var type = getContextualType(objectLiteral);
// TODO(jfreeman): Handle this case for computed names and symbols
var name = (<Identifier>declaration.name).text;
var name = (<Identifier>element.name).text;
if (type && name) {
return getTypeOfPropertyOfContextualType(type, name) ||
isNumericName(name) && getIndexTypeOfContextualType(type, IndexKind.Number) ||
@@ -4950,7 +4968,7 @@ module ts {
case SyntaxKind.BinaryExpression:
return getContextualTypeForBinaryOperand(node);
case SyntaxKind.PropertyAssignment:
return getContextualTypeForPropertyExpression(node);
return getContextualTypeForObjectLiteralElement(<ObjectLiteralElement>parent);
case SyntaxKind.ArrayLiteralExpression:
return getContextualTypeForElementExpression(node);
case SyntaxKind.ConditionalExpression:
@@ -4985,8 +5003,11 @@ module ts {
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node: FunctionExpression): Signature {
var type = getContextualType(node);
function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature {
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
var type = isObjectLiteralMethod(node)
? getContextualTypeForObjectLiteralMethod(<MethodDeclaration>node)
: getContextualType(<FunctionExpression>node);
if (!type) {
return undefined;
}
@@ -5082,11 +5103,14 @@ module ts {
for (var id in members) {
if (hasProperty(members, id)) {
var member = members[id];
if (member.flags & SymbolFlags.Property) {
var memberDecl = <PropertyDeclaration>member.declarations[0];
if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) {
var memberDecl = <ObjectLiteralElement>member.declarations[0];
var type: Type;
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
type = checkExpression(memberDecl.initializer, contextualMapper);
type = checkExpression((<PropertyAssignment>memberDecl).initializer, contextualMapper);
}
else if (memberDecl.kind === SyntaxKind.Method) {
type = checkObjectLiteralMethod(<MethodDeclaration>memberDecl, contextualMapper);
}
else {
Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment);
@@ -5097,7 +5121,10 @@ module ts {
var prop = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
prop.declarations = member.declarations;
prop.parent = member.parent;
if (member.valueDeclaration) prop.valueDeclaration = member.valueDeclaration;
if (member.valueDeclaration) {
prop.valueDeclaration = member.valueDeclaration;
}
prop.type = type;
prop.target = member;
member = prop;
@@ -5201,7 +5228,7 @@ module ts {
}
function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, right: Identifier) {
var type = checkExpression(left);
var type = checkExpressionOrQualifiedName(left);
if (type === unknownType) return type;
if (type !== anyType) {
var apparentType = getApparentType(getWidenedType(type));
@@ -5242,7 +5269,7 @@ module ts {
? (<PropertyAccessExpression>node).expression
: (<QualifiedName>node).left;
var type = checkExpression(left);
var type = checkExpressionOrQualifiedName(left);
if (type !== unknownType && type !== anyType) {
var prop = getPropertyOfType(getWidenedType(type), propertyName);
if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) {
@@ -5601,7 +5628,7 @@ module ts {
// because it represents a TemplateStringsArray.
var excludeArgument: boolean[];
for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) {
if (isContextSensitiveExpression(args[i])) {
if (isContextSensitive(args[i])) {
if (!excludeArgument) {
excludeArgument = new Array(args.length);
}
@@ -6024,7 +6051,7 @@ module ts {
function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type {
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
if (func.body.kind !== SyntaxKind.FunctionBlock) {
if (func.body.kind !== SyntaxKind.Block) {
var unwidenedType = checkAndMarkExpression(<Expression>func.body, contextualMapper);
var widenedType = getWidenedType(unwidenedType);
@@ -6111,7 +6138,7 @@ module ts {
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
if (!func.body || func.body.kind !== SyntaxKind.FunctionBlock) {
if (!func.body || func.body.kind !== SyntaxKind.Block) {
return;
}
@@ -6133,7 +6160,9 @@ module ts {
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement);
}
function checkFunctionExpression(node: FunctionExpression, contextualMapper?: TypeMapper): Type {
function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, contextualMapper?: TypeMapper): Type {
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
// The identityMapper object is used to indicate that function expressions are wildcards
if (contextualMapper === identityMapper) {
return anyFunctionType;
@@ -6150,7 +6179,7 @@ module ts {
links.flags |= NodeCheckFlags.ContextChecked;
if (contextualSignature) {
var signature = getSignaturesOfType(type, SignatureKind.Call)[0];
if (isContextSensitiveExpression(node)) {
if (isContextSensitive(node)) {
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
}
if (!node.type) {
@@ -6165,27 +6194,31 @@ module ts {
}
}
if (fullTypeCheck) {
checkCollisionWithCapturedSuperVariable(node, node.name);
checkCollisionWithCapturedThisVariable(node, node.name);
if (fullTypeCheck && node.kind !== SyntaxKind.Method) {
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
checkCollisionWithCapturedThisVariable(node,(<FunctionExpression>node).name);
}
return type;
}
function checkFunctionExpressionBody(node: FunctionExpression) {
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
Debug.assert(node.kind !== SyntaxKind.Method || isObjectLiteralMethod(node));
if (node.type) {
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
}
if (node.body.kind === SyntaxKind.FunctionBlock) {
checkSourceElement(node.body);
}
else {
var exprType = checkExpression(<Expression>node.body);
if (node.type) {
checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined);
if (node.body) {
if (node.body.kind === SyntaxKind.Block) {
checkSourceElement(node.body);
}
else {
var exprType = checkExpression(<Expression>node.body);
if (node.type) {
checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined);
}
checkFunctionExpressionBodies(node.body);
}
checkFunctionExpressionBodies(node.body);
}
}
@@ -6552,6 +6585,32 @@ module ts {
return result;
}
function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type {
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
}
function instantiateTypeWithSingleGenericCallSignature(node: Expression | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) {
if (contextualMapper && contextualMapper !== identityMapper) {
var signature = getSingleCallSignature(type);
if (signature && signature.typeParameters) {
var contextualType = getContextualType(<Expression>node);
if (contextualType) {
var contextualSignature = getSingleCallSignature(contextualType);
if (contextualSignature && !contextualSignature.typeParameters) {
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
}
}
}
}
return type;
}
function checkExpression(node: Expression, contextualMapper?: TypeMapper): Type {
return checkExpressionOrQualifiedName(node, contextualMapper);
}
// 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.12.2 in spec) and provides the type mapper to use in
@@ -6559,19 +6618,14 @@ module ts {
// object, it serves as an indicator that all contained function and arrow expressions should be considered to
// have the wildcard function type; this form of type check is used during overload resolution to exclude
// contextually typed function and arrow expressions in the initial phase.
function checkExpression(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type {
var type = checkExpressionNode(node, contextualMapper);
if (contextualMapper && contextualMapper !== identityMapper && node.kind !== SyntaxKind.QualifiedName) {
var signature = getSingleCallSignature(type);
if (signature && signature.typeParameters) {
var contextualType = getContextualType(<Expression>node);
if (contextualType) {
var contextualSignature = getSingleCallSignature(contextualType);
if (contextualSignature && !contextualSignature.typeParameters) {
type = getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
}
}
}
function checkExpressionOrQualifiedName(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type {
var type: Type;
if (node.kind == SyntaxKind.QualifiedName) {
type = checkQualifiedName(<QualifiedName>node);
}
else {
var uninstantiatedType = checkExpressionWorker(<Expression>node, contextualMapper);
type = instantiateTypeWithSingleGenericCallSignature(<Expression>node, uninstantiatedType, contextualMapper);
}
if (isConstEnumObjectType(type)) {
@@ -6591,7 +6645,7 @@ module ts {
return type;
}
function checkExpressionNode(node: Expression | QualifiedName, contextualMapper: TypeMapper): Type {
function checkExpressionWorker(node: Expression, contextualMapper: TypeMapper): Type {
switch (node.kind) {
case SyntaxKind.Identifier:
return checkIdentifier(<Identifier>node);
@@ -6613,8 +6667,6 @@ module ts {
return stringType;
case SyntaxKind.RegularExpressionLiteral:
return globalRegExpType;
case SyntaxKind.QualifiedName:
return checkQualifiedName(<QualifiedName>node);
case SyntaxKind.ArrayLiteralExpression:
return checkArrayLiteral(<ArrayLiteralExpression>node, contextualMapper);
case SyntaxKind.ObjectLiteralExpression:
@@ -6634,7 +6686,7 @@ module ts {
return checkExpression((<ParenthesizedExpression>node).expression);
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
return checkFunctionExpression(<FunctionExpression>node, contextualMapper);
return checkFunctionExpressionOrObjectLiteralMethod(<FunctionExpression>node, contextualMapper);
case SyntaxKind.TypeOfExpression:
return checkTypeOfExpression(<TypeOfExpression>node);
case SyntaxKind.DeleteExpression:
@@ -7360,6 +7412,9 @@ module ts {
function checkBlock(node: Block) {
forEach(node.statements, checkSourceElement);
if (isFunctionBlock(node) || node.kind === SyntaxKind.ModuleBlock) {
checkFunctionExpressionBodies(node);
}
}
function checkCollisionWithArgumentsInGeneratedCode(node: SignatureDeclaration) {
@@ -7904,7 +7959,7 @@ module ts {
}
// Check that base type can be evaluated as expression
checkExpression(baseTypeNode.typeName);
checkExpressionOrQualifiedName(baseTypeNode.typeName);
}
var implementedTypeNodes = getClassImplementedTypeNodes(node);
@@ -8393,7 +8448,7 @@ module ts {
// ensure it can be evaluated as an expression
var moduleName = getFirstIdentifier(<EntityName>node.moduleReference);
if (resolveEntityName(node, moduleName, SymbolFlags.Value | SymbolFlags.Namespace).flags & SymbolFlags.Namespace) {
checkExpression(<EntityName>node.moduleReference);
checkExpressionOrQualifiedName(<EntityName>node.moduleReference);
}
else {
error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName));
@@ -8491,10 +8546,8 @@ module ts {
case SyntaxKind.FunctionDeclaration:
return checkFunctionDeclaration(<FunctionDeclaration>node);
case SyntaxKind.Block:
return checkBlock(<Block>node);
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
return checkBody(<Block>node);
return checkBlock(<Block>node);
case SyntaxKind.VariableStatement:
return checkVariableStatement(<VariableStatement>node);
case SyntaxKind.ExpressionStatement:
@@ -8557,9 +8610,14 @@ module ts {
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
forEach((<FunctionLikeDeclaration>node).parameters, checkFunctionExpressionBodies);
checkFunctionExpressionBody(<FunctionExpression>node);
checkFunctionExpressionOrObjectLiteralMethodBody(<FunctionExpression>node);
break;
case SyntaxKind.Method:
forEach((<MethodDeclaration>node).parameters, checkFunctionExpressionBodies);
if (isObjectLiteralMethod(node)) {
checkFunctionExpressionOrObjectLiteralMethodBody(<MethodDeclaration>node);
}
break;
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
@@ -8589,7 +8647,6 @@ module ts {
case SyntaxKind.BinaryExpression:
case SyntaxKind.ConditionalExpression:
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.VariableStatement:
case SyntaxKind.ExpressionStatement:
@@ -8620,11 +8677,6 @@ module ts {
}
}
function checkBody(node: Block) {
checkBlock(node);
checkFunctionExpressionBodies(node);
}
// Fully type check a source file and collect the relevant diagnostics.
function checkSourceFile(node: SourceFile) {
var links = getNodeLinks(node);
@@ -9022,7 +9074,7 @@ module ts {
// This is necessary as an identifier in short-hand property assignment can contains two meaning:
// property name and property value.
if (location && location.kind === SyntaxKind.ShorthandPropertyAssignment) {
return resolveEntityName(location, (<ShorthandPropertyDeclaration>location).name, SymbolFlags.Value);
return resolveEntityName(location, (<ShorthandPropertyAssignment>location).name, SymbolFlags.Value);
}
return undefined;
}
+37 -10
View File
@@ -2227,6 +2227,30 @@ module ts {
emit(node.expression);
write("]");
}
function emitDownlevelMethod(node: MethodDeclaration) {
if (!isObjectLiteralMethod(node)) {
return;
}
emitLeadingComments(node);
emit(node.name);
write(": ");
write("function ");
emitSignatureAndBody(node);
emitTrailingComments(node);
}
function emitMethod(node: MethodDeclaration) {
if (!isObjectLiteralMethod(node)) {
return;
}
emitLeadingComments(node);
emit(node.name);
emitSignatureAndBody(node);
emitTrailingComments(node);
}
function emitPropertyAssignment(node: PropertyDeclaration) {
emitLeadingComments(node);
@@ -2236,7 +2260,7 @@ module ts {
emitTrailingComments(node);
}
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
function emitDownlevelShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
emitLeadingComments(node);
// Emit identifier as an identifier
emit(node.name);
@@ -2247,7 +2271,7 @@ module ts {
emitTrailingComments(node);
}
function emitShorthandPropertyAssignment(node: ShorthandPropertyDeclaration) {
function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) {
// If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example:
// module m {
// export var y;
@@ -2841,17 +2865,17 @@ module ts {
scopeEmitStart(node);
increaseIndent();
emitDetachedComments(node.body.kind === SyntaxKind.FunctionBlock ? (<Block>node.body).statements : node.body);
emitDetachedComments(node.body.kind === SyntaxKind.Block ? (<Block>node.body).statements : node.body);
var startIndex = 0;
if (node.body.kind === SyntaxKind.FunctionBlock) {
if (node.body.kind === SyntaxKind.Block) {
startIndex = emitDirectivePrologues((<Block>node.body).statements, /*startWithNewLine*/ true);
}
var outPos = writer.getTextPos();
emitCaptureThisForNodeIfNecessary(node);
emitDefaultValueAssignments(node);
emitRestParameter(node);
if (node.body.kind !== SyntaxKind.FunctionBlock && outPos === writer.getTextPos()) {
if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) {
decreaseIndent();
write(" ");
emitStart(node.body);
@@ -2864,7 +2888,7 @@ module ts {
emitEnd(node.body);
}
else {
if (node.body.kind === SyntaxKind.FunctionBlock) {
if (node.body.kind === SyntaxKind.Block) {
emitLinesStartingAt((<Block>node.body).statements, startIndex);
}
else {
@@ -2876,7 +2900,7 @@ module ts {
emitTrailingComments(node.body);
}
writeLine();
if (node.body.kind === SyntaxKind.FunctionBlock) {
if (node.body.kind === SyntaxKind.Block) {
emitLeadingCommentsOfPosition((<Block>node.body).statements.end);
decreaseIndent();
emitToken(SyntaxKind.CloseBraceToken, (<Block>node.body).statements.end);
@@ -3566,7 +3590,6 @@ module ts {
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
return emitBlock(<Block>node);
case SyntaxKind.VariableStatement:
@@ -3628,7 +3651,9 @@ module ts {
// Emit node down-level
switch (node.kind) {
case SyntaxKind.ShorthandPropertyAssignment:
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
return emitDownlevelShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
case SyntaxKind.Method:
return emitDownlevelMethod(<MethodDeclaration>node);
}
}
else {
@@ -3636,7 +3661,9 @@ module ts {
Debug.assert(compilerOptions.target >= ScriptTarget.ES6, "Invalid ScriptTarget. We should emit as ES6 or above");
switch (node.kind) {
case SyntaxKind.ShorthandPropertyAssignment:
return emitShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
return emitShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
case SyntaxKind.Method:
return emitMethod(<MethodDeclaration>node);
}
}
}
+64 -86
View File
@@ -311,7 +311,6 @@ module ts {
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
return children((<Block>node).statements);
case SyntaxKind.SourceFile:
@@ -435,7 +434,6 @@ module ts {
case SyntaxKind.ReturnStatement:
return visitor(<ReturnStatement>node);
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.IfStatement:
case SyntaxKind.DoStatement:
case SyntaxKind.WhileStatement:
@@ -472,6 +470,14 @@ module ts {
return false;
}
export function isFunctionBlock(node: Node) {
return node !== undefined && node.kind === SyntaxKind.Block && isAnyFunction(node.parent);
}
export function isObjectLiteralMethod(node: Node) {
return node !== undefined && node.kind === SyntaxKind.Method && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
}
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
while (true) {
node = node.parent;
@@ -1918,16 +1924,10 @@ module ts {
return parseInitializer(/*inParameter*/ true);
}
function parseSignature(yieldAndGeneratorParameterContext: boolean): ParsedSignature {
var signature = <ParsedSignature>{};
fillSignature(SyntaxKind.ColonToken, yieldAndGeneratorParameterContext, signature);
return signature;
}
function fillSignature(
returnToken: SyntaxKind,
yieldAndGeneratorParameterContext: boolean,
signature: ParsedSignature): void {
signature: SignatureDeclaration): void {
var returnTokenRequired = returnToken === SyntaxKind.EqualsGreaterThanToken;
signature.typeParameters = parseTypeParameters();
signature.parameters = parseParameterList(yieldAndGeneratorParameterContext);
@@ -3166,26 +3166,21 @@ module ts {
return finishNode(node);
}
function parsePropertyAssignment(): Declaration {
var nodePos = scanner.getStartPos();
function parseObjectLiteralElement(): ObjectLiteralElement {
var fullStart = scanner.getStartPos();
var initialToken = token;
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
return parseAccessorDeclaration(kind, fullStart, /*modifiers*/undefined);
}
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
var tokenIsIdentifier = isIdentifier();
var nameToken = token;
var propertyName = parsePropertyName();
var node: Declaration;
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
node = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
node.name = propertyName;
var sig = parseSignature(/*yieldAndGeneratorParameterContext:*/ !!asteriskToken);
var body = parseFunctionBlock(!!asteriskToken, /* ignoreMissingOpenBrace */ false);
// do not propagate property name as name for function expression
// for scenarios like
// var x = 1;
// var y = { x() { } }
// otherwise this will bring y.x into the scope of x which is incorrect
(<PropertyDeclaration>node).initializer = makeFunctionExpression(SyntaxKind.FunctionExpression, node.pos, asteriskToken, undefined, sig, body);
return finishNode(node);
return parseMethodDeclaration(fullStart, /*modifiers:*/ undefined, asteriskToken, propertyName, /*questionToken:*/ undefined, /*requireBlock:*/ true);
}
// Disallowing of optional property assignments happens in the grammar checker.
@@ -3193,31 +3188,21 @@ module ts {
// Parse to check if it is short-hand property assignment or normal property assignment
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
var shorthandDeclaration = <ShorthandPropertyDeclaration>createNode(SyntaxKind.ShorthandPropertyAssignment, nodePos);
var shorthandDeclaration = <ShorthandPropertyAssignment>createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart);
shorthandDeclaration.name = <Identifier>propertyName;
shorthandDeclaration.questionToken = questionToken;
return finishNode(shorthandDeclaration);
}
else {
var propertyDeclaration = <PropertyDeclaration>createNode(SyntaxKind.PropertyAssignment, nodePos);
propertyDeclaration.name = propertyName;
propertyDeclaration.questionToken = questionToken;
var propertyAssignment = <PropertyAssignment>createNode(SyntaxKind.PropertyAssignment, fullStart);
propertyAssignment.name = propertyName;
propertyAssignment.questionToken = questionToken;
parseExpected(SyntaxKind.ColonToken);
propertyDeclaration.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return finishNode(propertyDeclaration);
propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
return finishNode(propertyAssignment);
}
}
function parseObjectLiteralMember(): Declaration {
var initialPos = getNodePos();
var initialToken = token;
if (parseContextualModifier(SyntaxKind.GetKeyword) || parseContextualModifier(SyntaxKind.SetKeyword)) {
var kind = initialToken === SyntaxKind.GetKeyword ? SyntaxKind.GetAccessor : SyntaxKind.SetAccessor;
return parseMemberAccessorDeclaration(kind, initialPos, /*modifiers*/ undefined);
}
return parsePropertyAssignment();
}
function parseObjectLiteralExpression(): ObjectLiteralExpression {
var node = <ObjectLiteralExpression>createNode(SyntaxKind.ObjectLiteralExpression);
parseExpected(SyntaxKind.OpenBraceToken);
@@ -3225,7 +3210,7 @@ module ts {
node.flags |= NodeFlags.MultiLine;
}
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralMember);
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement);
parseExpected(SyntaxKind.CloseBraceToken);
return finishNode(node);
}
@@ -3248,17 +3233,6 @@ module ts {
return isIdentifier() ? parseIdentifier() : undefined;
}
function makeFunctionExpression(kind: SyntaxKind, pos: number, asteriskToken: Node, name: Identifier, sig: ParsedSignature, body: Block | Expression): FunctionExpression {
var node = <FunctionExpression>createNode(kind, pos);
node.asteriskToken = asteriskToken;
node.name = name;
node.typeParameters = sig.typeParameters;
node.parameters = sig.parameters;
node.type = sig.type;
node.body = body;
return finishNode(node);
}
function parseNewExpression(): NewExpression {
var node = <NewExpression>createNode(SyntaxKind.NewExpression);
parseExpected(SyntaxKind.NewKeyword);
@@ -3291,7 +3265,7 @@ module ts {
var savedYieldContext = inYieldContext();
setYieldContext(allowYield);
var block = parseBlock(SyntaxKind.FunctionBlock, ignoreMissingOpenBrace, /*checkForStrictMode*/ true);
var block = parseBlock(SyntaxKind.Block, ignoreMissingOpenBrace, /*checkForStrictMode*/ true);
setYieldContext(savedYieldContext);
@@ -3668,7 +3642,7 @@ module ts {
function parseFunctionBlockOrSemicolon(isGenerator: boolean): Block {
if (token === SyntaxKind.OpenBraceToken) {
return parseFunctionBlock(isGenerator, /* ignoreMissingOpenBrace */ false);
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace:*/ false);
}
parseSemicolon(Diagnostics.or_expected);
@@ -3739,7 +3713,18 @@ module ts {
return finishNode(node);
}
function parsePropertyMemberDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
function parseMethodDeclaration(fullStart: number, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, requireBlock: boolean): MethodDeclaration {
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
setModifiers(method, modifiers);
method.asteriskToken = asteriskToken;
method.name = name;
method.questionToken = questionToken;
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
method.body = requireBlock ? parseFunctionBlock(!!asteriskToken, /*ignoreMissingOpenBrace:*/ false) : parseFunctionBlockOrSemicolon(!!asteriskToken);
return finishNode(method);
}
function parsePropertyOrMethodDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement {
var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
var name = parsePropertyName();
@@ -3747,14 +3732,7 @@ module ts {
// report an error in the grammar checker.
var questionToken = parseOptionalToken(SyntaxKind.QuestionToken);
if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) {
var method = <MethodDeclaration>createNode(SyntaxKind.Method, fullStart);
setModifiers(method, modifiers);
method.asteriskToken = asteriskToken;
method.name = name;
method.questionToken = questionToken;
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, method);
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken);
return finishNode(method);
return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, /*requireBlock:*/ false);
}
else {
var property = <PropertyDeclaration>createNode(SyntaxKind.Property, fullStart);
@@ -3772,8 +3750,8 @@ module ts {
return parseInitializer(/*inParameter*/ false);
}
function parseMemberAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): MethodDeclaration {
var node = <MethodDeclaration>createNode(kind, fullStart);
function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): AccessorDeclaration {
var node = <AccessorDeclaration>createNode(kind, fullStart);
setModifiers(node, modifiers);
node.name = parsePropertyName();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, node);
@@ -3864,10 +3842,10 @@ module ts {
var fullStart = getNodePos();
var modifiers = parseModifiers();
if (parseContextualModifier(SyntaxKind.GetKeyword)) {
return parseMemberAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
return parseAccessorDeclaration(SyntaxKind.GetAccessor, fullStart, modifiers);
}
if (parseContextualModifier(SyntaxKind.SetKeyword)) {
return parseMemberAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
return parseAccessorDeclaration(SyntaxKind.SetAccessor, fullStart, modifiers);
}
if (token === SyntaxKind.ConstructorKeyword) {
return parseConstructorDeclaration(fullStart, modifiers);
@@ -3879,7 +3857,7 @@ module ts {
// the [ token can start an index signature or a computed property name
if (isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral ||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBracketToken) {
return parsePropertyMemberDeclaration(fullStart, modifiers);
return parsePropertyOrMethodDeclaration(fullStart, modifiers);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
@@ -4364,7 +4342,7 @@ module ts {
if (!checkModifiers(node)) {
var savedInFunctionBlock = inFunctionBlock;
if (node.kind === SyntaxKind.FunctionBlock) {
if (isFunctionBlock(node)) {
inFunctionBlock = true;
}
@@ -4408,7 +4386,7 @@ module ts {
case SyntaxKind.ConstructorType:
case SyntaxKind.ConstructSignature:
case SyntaxKind.FunctionType:
return checkAnyParsedSignature(<FunctionLikeDeclaration>node);
return checkAnySignatureDeclaration(<FunctionLikeDeclaration>node);
case SyntaxKind.BreakStatement:
case SyntaxKind.ContinueStatement:
return checkBreakOrContinueStatement(<BreakOrContinueStatement>node);
@@ -4435,6 +4413,7 @@ module ts {
case SyntaxKind.IndexSignature: return checkIndexSignature(<SignatureDeclaration>node);
case SyntaxKind.InterfaceDeclaration: return checkInterfaceDeclaration(<InterfaceDeclaration>node);
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyAssignment>node);
case SyntaxKind.Method: return checkMethod(<MethodDeclaration>node);
case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(<ModuleDeclaration>node);
case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteralExpression(<ObjectLiteralExpression>node);
@@ -4443,11 +4422,10 @@ module ts {
case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(<PostfixUnaryExpression>node);
case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
case SyntaxKind.Property: return checkProperty(<PropertyDeclaration>node);
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyDeclaration>node);
case SyntaxKind.ReturnStatement: return checkReturnStatement(<ReturnStatement>node);
case SyntaxKind.SetAccessor: return checkSetAccessor(<MethodDeclaration>node);
case SyntaxKind.SourceFile: return checkSourceFile(<SourceFile>node);
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyDeclaration>node);
case SyntaxKind.ShorthandPropertyAssignment: return checkShorthandPropertyAssignment(<ShorthandPropertyAssignment>node);
case SyntaxKind.SwitchStatement: return checkSwitchStatement(<SwitchStatement>node);
case SyntaxKind.TaggedTemplateExpression: return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
case SyntaxKind.ThrowStatement: return checkThrowStatement(<ThrowStatement>node);
@@ -4523,7 +4501,7 @@ module ts {
}
}
function checkAnyParsedSignature(node: ParsedSignature): boolean {
function checkAnySignatureDeclaration(node: SignatureDeclaration): boolean {
return checkTypeParameterList(node.typeParameters) ||
checkParameterList(node.parameters);
}
@@ -4737,7 +4715,7 @@ module ts {
}
function checkConstructor(node: ConstructorDeclaration) {
return checkAnyParsedSignature(node) ||
return checkAnySignatureDeclaration(node) ||
checkConstructorTypeParameters(node) ||
checkConstructorTypeAnnotation(node) ||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ true);
@@ -4845,7 +4823,7 @@ module ts {
}
function checkFunctionDeclaration(node: FunctionLikeDeclaration) {
return checkAnyParsedSignature(node) ||
return checkAnySignatureDeclaration(node) ||
checkFunctionName(node.name) ||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
checkForGenerator(node);
@@ -4858,7 +4836,7 @@ module ts {
}
function checkFunctionExpression(node: FunctionExpression) {
return checkAnyParsedSignature(node) ||
return checkAnySignatureDeclaration(node) ||
checkFunctionName(node.name) ||
checkForGenerator(node);
}
@@ -4872,7 +4850,7 @@ module ts {
}
function checkGetAccessor(node: MethodDeclaration) {
return checkAnyParsedSignature(node) ||
return checkAnySignatureDeclaration(node) ||
checkAccessor(node);
}
@@ -4970,11 +4948,12 @@ module ts {
}
function checkMethod(node: MethodDeclaration) {
if (checkAnyParsedSignature(node) ||
if (checkAnySignatureDeclaration(node) ||
checkForBodyInAmbientContext(node.body, /*isConstructor:*/ false) ||
checkForGenerator(node)) {
return true;
}
if (node.parent.kind === SyntaxKind.ClassDeclaration) {
if (checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional)) {
return true;
@@ -5000,7 +4979,7 @@ module ts {
}
function checkForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean {
if (inAmbientContext && body && body.kind === SyntaxKind.FunctionBlock) {
if (inAmbientContext && body && body.kind === SyntaxKind.Block) {
var diagnostic = isConstructor
? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context
: Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context;
@@ -5060,10 +5039,9 @@ module ts {
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind: number;
if (prop.kind === SyntaxKind.PropertyAssignment) {
currentKind = Property;
}
else if (prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
if (prop.kind === SyntaxKind.PropertyAssignment ||
prop.kind === SyntaxKind.ShorthandPropertyAssignment ||
prop.kind === SyntaxKind.Method) {
currentKind = Property;
}
else if (prop.kind === SyntaxKind.GetAccessor) {
@@ -5364,7 +5342,7 @@ module ts {
}
}
function checkPropertyAssignment(node: PropertyDeclaration) {
function checkPropertyAssignment(node: PropertyAssignment) {
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
}
@@ -5381,7 +5359,7 @@ module ts {
}
function checkSetAccessor(node: MethodDeclaration) {
return checkAnyParsedSignature(node) ||
return checkAnySignatureDeclaration(node) ||
checkAccessor(node);
}
@@ -5464,7 +5442,7 @@ module ts {
return grammarErrorOnFirstToken(node, Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
}
function checkShorthandPropertyAssignment(node: ShorthandPropertyDeclaration): boolean {
function checkShorthandPropertyAssignment(node: ShorthandPropertyAssignment): boolean {
return checkForInvalidQuestionMark(node, node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
}
+35 -15
View File
@@ -212,7 +212,6 @@ module ts {
DebuggerStatement,
VariableDeclaration,
FunctionDeclaration,
FunctionBlock,
ClassDeclaration,
InterfaceDeclaration,
TypeAliasDeclaration,
@@ -234,6 +233,7 @@ module ts {
// Property assignments
PropertyAssignment,
ShorthandPropertyAssignment,
// Enum
EnumMember,
// Top-level nodes
@@ -334,13 +334,6 @@ module ts {
}
export type EntityName = Identifier | QualifiedName;
export interface ParsedSignature {
typeParameters?: NodeArray<TypeParameterDeclaration>;
parameters: NodeArray<ParameterDeclaration>;
type?: TypeNode;
}
export type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName;
export interface Declaration extends Node {
@@ -360,7 +353,10 @@ module ts {
expression?: Expression;
}
export interface SignatureDeclaration extends Declaration, ParsedSignature {
export interface SignatureDeclaration extends Declaration {
typeParameters?: NodeArray<TypeParameterDeclaration>;
parameters: NodeArray<ParameterDeclaration>;
type?: TypeNode;
}
export interface VariableDeclaration extends Declaration {
@@ -378,6 +374,7 @@ module ts {
}
export interface PropertyDeclaration extends Declaration, ClassElement {
_propertyDeclarationBrand: any;
questionToken?: Node;
type?: TypeNode;
initializer?: Expression;
@@ -386,11 +383,22 @@ module ts {
export type VariableOrParameterDeclaration = VariableDeclaration | ParameterDeclaration;
export type VariableOrParameterOrPropertyDeclaration = VariableOrParameterDeclaration | PropertyDeclaration;
export interface ShorthandPropertyDeclaration extends Declaration {
export interface ObjectLiteralElement extends Declaration {
_objectLiteralBrandBrand: any;
}
export interface ShorthandPropertyAssignment extends ObjectLiteralElement {
name: Identifier;
questionToken?: Node;
}
export interface PropertyAssignment extends ObjectLiteralElement {
_propertyAssignmentBrand: any;
name: DeclarationName;
questionToken?: Node;
initializer: Expression;
}
/**
* Several node kinds share function-like features such as a signature,
* a name, and a body. These nodes should extend FunctionLikeDeclaration.
@@ -412,7 +420,16 @@ module ts {
body?: Block;
}
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement {
// Note that a MethodDeclaration is considered both a ClassElement and an ObjectLiteralElement.
// Both the grammars for ClassDeclaration and ObjectLiteralExpression allow for MethodDeclarations
// as child elements, and so a MethodDeclaration satisfies both interfaces. This avoids the
// alternative where we would need separate kinds/types for ClassMethodDeclaration and
// ObjectLiteralMethodDeclaration, which would look identical.
//
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
// of the method, or use helpers like isObjectLiteralMethodDeclaration
export interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
body?: Block;
}
@@ -420,8 +437,11 @@ module ts {
body?: Block;
}
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement {
body?: Block;
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
// ClassElement and an ObjectLiteralElement.
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
_accessorDeclarationBrand: any;
body: Block;
}
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement {
@@ -576,7 +596,7 @@ module ts {
// An ObjectLiteralExpression is the declaration node for an anonymous symbol.
export interface ObjectLiteralExpression extends PrimaryExpression, Declaration {
properties: NodeArray<Declaration>;
properties: NodeArray<ObjectLiteralElement>;
}
export interface PropertyAccessExpression extends MemberExpression {
@@ -901,7 +921,7 @@ module ts {
getFullyQualifiedName(symbol: Symbol): string;
getAugmentedPropertiesOfType(type: Type): Symbol[];
getRootSymbols(symbol: Symbol): Symbol[];
getContextualType(node: Node): Type;
getContextualType(node: Expression): Type;
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
+10 -4
View File
@@ -101,10 +101,11 @@ module ts.BreakpointResolver {
case SyntaxKind.ArrowFunction:
return spanInFunctionDeclaration(<FunctionLikeDeclaration>node);
case SyntaxKind.FunctionBlock:
return spanInFunctionBlock(<Block>node);
case SyntaxKind.Block:
if (isFunctionBlock(node)) {
return spanInFunctionBlock(<Block>node);
}
// Fall through
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
@@ -414,13 +415,18 @@ module ts.BreakpointResolver {
return undefined;
}
case SyntaxKind.FunctionBlock:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ClassDeclaration:
// Span on close brace token
return textSpan(node);
case SyntaxKind.Block:
if (isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// fall through.
case SyntaxKind.TryBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
+1 -1
View File
@@ -897,7 +897,7 @@ module ts.formatting {
function isSomeBlock(kind: SyntaxKind): boolean {
switch (kind) {
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.Block:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
-2
View File
@@ -526,7 +526,6 @@ module ts.formatting {
case SyntaxKind.ObjectLiteralExpression:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
return true;
}
@@ -582,7 +581,6 @@ module ts.formatting {
case SyntaxKind.TryBlock:
case SyntaxKind.CatchClause:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.SwitchStatement:
return true;
+3 -3
View File
@@ -120,7 +120,7 @@ module ts.NavigationBar {
if (functionDeclaration.kind === SyntaxKind.FunctionDeclaration) {
// A function declaration is 'top level' if it contains any function declarations
// within it.
if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.FunctionBlock) {
if (functionDeclaration.body && functionDeclaration.body.kind === SyntaxKind.Block) {
// Proper function declarations can only have identifier names
if (forEach((<Block>functionDeclaration.body).statements,
s => s.kind === SyntaxKind.FunctionDeclaration && !isEmpty((<FunctionDeclaration>s).name.text))) {
@@ -130,7 +130,7 @@ module ts.NavigationBar {
// Or if it is not parented by another function. i.e all functions
// at module scope are 'top level'.
if (functionDeclaration.parent.kind !== SyntaxKind.FunctionBlock) {
if (!isFunctionBlock(functionDeclaration.parent)) {
return true;
}
}
@@ -333,7 +333,7 @@ module ts.NavigationBar {
}
function createFunctionItem(node: FunctionDeclaration) {
if (node.name && node.body && node.body.kind === SyntaxKind.FunctionBlock) {
if (node.name && node.body && node.body.kind === SyntaxKind.Block) {
var childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
return getNavigationBarItem(node.name.text,
+30 -29
View File
@@ -67,38 +67,39 @@ module ts {
}
switch (n.kind) {
case SyntaxKind.Block:
var parent = n.parent;
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
if (!isFunctionBlock(n)) {
var parent = n.parent;
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collaps the block, but consider its hint span
// to be the entire span of the parent.
if (parent.kind === SyntaxKind.DoStatement ||
parent.kind === SyntaxKind.ForInStatement ||
parent.kind === SyntaxKind.ForStatement ||
parent.kind === SyntaxKind.IfStatement ||
parent.kind === SyntaxKind.WhileStatement ||
parent.kind === SyntaxKind.WithStatement ||
parent.kind === SyntaxKind.CatchClause) {
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collaps the block, but consider its hint span
// to be the entire span of the parent.
if (parent.kind === SyntaxKind.DoStatement ||
parent.kind === SyntaxKind.ForInStatement ||
parent.kind === SyntaxKind.ForStatement ||
parent.kind === SyntaxKind.IfStatement ||
parent.kind === SyntaxKind.WhileStatement ||
parent.kind === SyntaxKind.WithStatement ||
parent.kind === SyntaxKind.CatchClause) {
addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n));
}
else {
// Block was a standalone block. In this case we want to only collapse
// the span of the block, independent of any parent span.
var span = TextSpan.fromBounds(n.getStart(), n.end);
elements.push({
textSpan: span,
hintSpan: span,
bannerText: collapseText,
autoCollapse: autoCollapse(n)
});
}
break;
}
else {
// Block was a standalone block. In this case we want to only collapse
// the span of the block, independent of any parent span.
var span = TextSpan.fromBounds(n.getStart(), n.end);
elements.push({
textSpan: span,
hintSpan: span,
bannerText: collapseText,
autoCollapse: autoCollapse(n)
});
}
break;
// Fallthrough.
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
+21 -7
View File
@@ -806,10 +806,15 @@ module ts {
case SyntaxKind.Constructor:
case SyntaxKind.VariableStatement:
case SyntaxKind.ModuleBlock:
case SyntaxKind.FunctionBlock:
forEachChild(node, visit);
break;
case SyntaxKind.Block:
if (isFunctionBlock(node)) {
forEachChild(node, visit);
}
break;
case SyntaxKind.Parameter:
// Only consider properties defined as constructor parameters
if (!(node.flags & NodeFlags.AccessibilityModifier)) {
@@ -1444,7 +1449,7 @@ module ts {
}
// If the parent is not sourceFile or module block it is local variable
for (var parent = declaration.parent; parent.kind !== SyntaxKind.FunctionBlock; parent = parent.parent) {
for (var parent = declaration.parent; !isFunctionBlock(parent); parent = parent.parent) {
// Reached source file or module block
if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) {
return false;
@@ -3526,7 +3531,7 @@ module ts {
var func = <FunctionLikeDeclaration>getContainingFunction(returnStatement);
// If we didn't find a containing function with a block body, bail out.
if (!(func && hasKind(func.body, SyntaxKind.FunctionBlock))) {
if (!(func && hasKind(func.body, SyntaxKind.Block))) {
return undefined;
}
@@ -3558,7 +3563,7 @@ module ts {
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
// ability to "jump out" of the function, and include occurrences for both.
if (owner.kind === SyntaxKind.FunctionBlock) {
if (isFunctionBlock(owner)) {
forEachReturnStatement(<Block>owner, returnStatement => {
pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword);
});
@@ -3614,7 +3619,7 @@ module ts {
while (child.parent) {
var parent = child.parent;
if (parent.kind === SyntaxKind.FunctionBlock || parent.kind === SyntaxKind.SourceFile) {
if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) {
return parent;
}
@@ -4311,8 +4316,12 @@ module ts {
var staticFlag = NodeFlags.Static;
switch (searchSpaceNode.kind) {
case SyntaxKind.Property:
case SyntaxKind.Method:
if (isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// fall through
case SyntaxKind.Property:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
@@ -4365,6 +4374,11 @@ module ts {
result.push(getReferenceEntryFromNode(node));
}
break;
case SyntaxKind.Method:
if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) {
result.push(getReferenceEntryFromNode(node));
}
break;
case SyntaxKind.ClassDeclaration:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
@@ -4493,7 +4507,7 @@ module ts {
function getPropertySymbolsFromContextualType(node: Node): Symbol[] {
if (isNameOfPropertyAssignment(node)) {
var objectLiteral = node.parent.parent;
var objectLiteral = <ObjectLiteralExpression>node.parent.parent;
var contextualType = typeInfoResolver.getContextualType(objectLiteral);
var name = (<Identifier>node).text;
if (contextualType) {
+1 -1
View File
@@ -396,7 +396,7 @@ module ts.SignatureHelp {
function getContainingArgumentInfo(node: Node): ArgumentListInfo {
for (var n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) {
if (n.kind === SyntaxKind.FunctionBlock) {
if (isFunctionBlock(n)) {
return undefined;
}
+1 -4
View File
@@ -326,7 +326,6 @@ module ts.formatting {
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ArrayLiteralExpression:
case SyntaxKind.Block:
case SyntaxKind.FunctionBlock:
case SyntaxKind.TryBlock:
case SyntaxKind.FinallyBlock:
case SyntaxKind.ModuleBlock:
@@ -357,7 +356,6 @@ module ts.formatting {
case SyntaxKind.ForInStatement:
case SyntaxKind.ForStatement:
case SyntaxKind.IfStatement:
return child !== SyntaxKind.Block;
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.Method:
@@ -365,7 +363,7 @@ module ts.formatting {
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return child !== SyntaxKind.FunctionBlock;
return child !== SyntaxKind.Block;
default:
return false;
}
@@ -404,7 +402,6 @@ module ts.formatting {
case SyntaxKind.ObjectLiteralExpression:
case SyntaxKind.Block:
case SyntaxKind.FinallyBlock:
case SyntaxKind.FunctionBlock:
case SyntaxKind.ModuleBlock:
case SyntaxKind.SwitchStatement:
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
+1 -1
View File
@@ -3444,7 +3444,7 @@ module TypeScript.Parser {
parseArrowFunctionBody(/*asyncContext:*/ !!asyncKeyword));
}
function isFunctionBlock(): boolean {
function isStartOfFunctionBlock(): boolean {
var currentTokenKind = currentToken().kind;
return currentTokenKind === SyntaxKind.OpenBraceToken || currentTokenKind === SyntaxKind.EqualsGreaterThanToken;
}
@@ -1,10 +1,7 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: 'generators' are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ====
var v = { *[foo()]() { } }
~
!!! error TS9001: 'generators' are not currently supported.
~~~~~~~
!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
!!! error TS9001: 'generators' are not currently supported.
@@ -132,18 +132,16 @@ x = i;
>i : () => string
x = { f() { return 1; } }
>x = { f() { return 1; } } : { f: () => number; }
>x = { f() { return 1; } } : { f(): number; }
>x : any
>{ f() { return 1; } } : { f: () => number; }
>{ f() { return 1; } } : { f(): number; }
>f : () => number
>f() { return 1; } : () => number
x = { f<T>(x: T) { return x; } }
>x = { f<T>(x: T) { return x; } } : { f: <T>(x: T) => T; }
>x = { f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
>x : any
>{ f<T>(x: T) { return x; } } : { f: <T>(x: T) => T; }
>{ f<T>(x: T) { return x; } } : { f<T>(x: T): T; }
>f : <T>(x: T) => T
>f<T>(x: T) { return x; } : <T>(x: T) => T
>T : T
>x : T
>T : T
@@ -133,12 +133,11 @@ a.foo(1);
>foo : (x?: number) => any
var b = {
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>{ foo(x?: number) { }, a: function foo(x: number, y?: number) { }, b: (x?: number) => { }} : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>{ foo(x?: number) { }, a: function foo(x: number, y?: number) { }, b: (x?: number) => { }} : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
foo(x?: number) { },
>foo : (x?: number) => void
>foo(x?: number) { } : (x?: number) => void
>x : number
a: function foo(x: number, y?: number) { },
@@ -157,36 +156,36 @@ var b = {
b.foo();
>b.foo() : void
>b.foo : (x?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>foo : (x?: number) => void
b.foo(1);
>b.foo(1) : void
>b.foo : (x?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>foo : (x?: number) => void
b.a(1);
>b.a(1) : void
>b.a : (x: number, y?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>a : (x: number, y?: number) => void
b.a(1, 2);
>b.a(1, 2) : void
>b.a : (x: number, y?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>a : (x: number, y?: number) => void
b.b();
>b.b() : void
>b.b : (x?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : (x?: number) => void
b.b(1);
>b.b(1) : void
>b.b : (x?: number) => void
>b : { foo: (x?: number) => void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
>b : (x?: number) => void
@@ -1,8 +1,8 @@
=== tests/cases/compiler/commentsOnObjectLiteral3.ts ===
var v = {
>v : { prop: number; func: () => void; func1: () => void; a: any; }
>{ //property prop: 1 /* multiple trailing comments */ /*trailing comments*/, //property func: function () { }, //PropertyName + CallSignature func1() { }, //getter get a() { return this.prop; } /*trailing 1*/, //setter set a(value) { this.prop = value; } // trailing 2} : { prop: number; func: () => void; func1: () => void; a: any; }
>v : { prop: number; func: () => void; func1(): void; a: any; }
>{ //property prop: 1 /* multiple trailing comments */ /*trailing comments*/, //property func: function () { }, //PropertyName + CallSignature func1() { }, //getter get a() { return this.prop; } /*trailing 1*/, //setter set a(value) { this.prop = value; } // trailing 2} : { prop: number; func: () => void; func1(): void; a: any; }
//property
prop: 1 /* multiple trailing comments */ /*trailing comments*/,
@@ -17,7 +17,6 @@ var v = {
//PropertyName + CallSignature
func1() { },
>func1 : () => void
>func1() { } : () => void
//getter
get a() {
@@ -265,7 +265,7 @@ var C = (function () {
})();
// object literals
var o = {
f: function () {
f() {
const c = 0;
n = c;
},
@@ -220,7 +220,7 @@ var C = (function () {
})();
// object literals
var o = {
f: function () {
f() {
const c28 = 0;
},
f2: function () {
@@ -68,11 +68,10 @@ x = M;
>M : typeof M
x = { f() { } }
>x = { f() { } } : { f: () => void; }
>x = { f() { } } : { f(): void; }
>x : any
>{ f() { } } : { f: () => void; }
>{ f() { } } : { f(): void; }
>f : () => void
>f() { } : () => void
function f<T>(a: T) {
>f : <T>(a: T) => void
@@ -12,7 +12,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(21,5): e
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(23,1): error TS2364: Invalid left-hand side of assignment expression.
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(26,1): error TS2322: Type 'typeof E' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(27,1): error TS2322: Type 'E' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
==== tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts (13 errors) ====
@@ -72,4 +72,4 @@ tests/cases/conformance/types/primitives/void/invalidVoidAssignments.ts(29,1): e
x = { f() { } }
~
!!! error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
!!! error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
@@ -5,7 +5,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(7,1): error T
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(8,1): error TS2322: Type 'E' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(12,1): error TS2322: Type 'C' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(16,1): error TS2322: Type 'I' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(18,1): error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(18,1): error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(21,1): error TS2322: Type 'typeof M' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(24,5): error TS2322: Type 'T' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(26,1): error TS2322: Type '<T>(a: T) => void' is not assignable to type 'void'.
@@ -45,7 +45,7 @@ tests/cases/conformance/types/primitives/void/invalidVoidValues.ts(26,1): error
x = { f() {} }
~
!!! error TS2322: Type '{ f: () => void; }' is not assignable to type 'void'.
!!! error TS2322: Type '{ f(): void; }' is not assignable to type 'void'.
module M { export var x = 1; }
x = M;
@@ -282,7 +282,7 @@ var C = (function () {
})();
// object literals
var o = {
f: function () {
f() {
let l = 0;
n = l;
},
@@ -240,7 +240,7 @@ var C = (function () {
})();
// object literals
var o = {
f: function () {
f() {
let l28 = 0;
},
f2: function () {
@@ -3,10 +3,9 @@ var x = 1
>x : number
var y = { x() { x++; } };
>y : { x: () => void; }
>{ x() { x++; } } : { x: () => void; }
>y : { x(): void; }
>{ x() { x++; } } : { x(): void; }
>x : () => void
>x() { x++; } : () => void
>x++ : number
>x : number
@@ -7,7 +7,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(21,5): error TS2412: Property '3.0' of type 'MyNumber' is not assignable to numeric index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
Index signatures are incompatible.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
@@ -108,7 +108,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo
// error
var b: { [x: number]: string; } = {
~
!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo: () => string; }' is not assignable to type '{ [x: number]: string; }'.
!!! error TS2322: Type '{ [x: number]: string | number; 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -23,7 +23,7 @@ var x2 = {
var x3 = {
>x3 : any
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d: () => void; x3: any; parent: any; }
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d(): void; x3: any; parent: any; }
a: 0,
>a : number
@@ -36,7 +36,6 @@ var x3 = {
d() { },
>d : () => void
>d() { } : () => void
x3,
>x3 : any
@@ -32,7 +32,7 @@ var x3 = {
a: 0,
b,
c,
d: function () {
d() {
},
x3,
parent: x3
@@ -23,7 +23,7 @@ var x2 = {
var x3 = {
>x3 : any
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d: () => void; x3: any; parent: any; }
>{ a: 0, b, c, d() { }, x3, parent: x3} : { a: number; b: any; c: any; d(): void; x3: any; parent: any; }
a: 0,
>a : number
@@ -36,7 +36,6 @@ var x3 = {
d() { },
>d : () => void
>d() { } : () => void
x3,
>x3 : any
@@ -53,10 +53,9 @@ var a: { foo(x: string): string }
>x : string
var b = { foo(x: string) { return ''; } };
>b : { foo: (x: string) => string; }
>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; }
>b : { foo(x: string): string; }
>{ foo(x: string) { return ''; } } : { foo(x: string): string; }
>foo : (x: string) => string
>foo(x: string) { return ''; } : (x: string) => string
>x : string
function foo1(x: A);
@@ -130,17 +129,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo4(x: any) { }
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo5(x: A);
@@ -242,17 +241,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // error
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo12(x: I);
@@ -298,17 +297,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // error
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -54,10 +54,9 @@ var a: { foo(x: Date): string }
>Date : Date
var b = { foo(x: RegExp) { return ''; } };
>b : { foo: (x: RegExp) => string; }
>{ foo(x: RegExp) { return ''; } } : { foo: (x: RegExp) => string; }
>b : { foo(x: RegExp): string; }
>{ foo(x: RegExp) { return ''; } } : { foo(x: RegExp): string; }
>foo : (x: RegExp) => string
>foo(x: RegExp) { return ''; } : (x: RegExp) => string
>x : RegExp
>RegExp : RegExp
@@ -132,17 +131,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
>x : { foo: (x: RegExp) => string; }
>b : { foo: (x: RegExp) => string; }
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
>x : { foo(x: RegExp): string; }
>b : { foo(x: RegExp): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
>x : { foo: (x: RegExp) => string; }
>b : { foo: (x: RegExp) => string; }
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
>x : { foo(x: RegExp): string; }
>b : { foo(x: RegExp): string; }
function foo4(x: any) { }
>foo4 : { (x: { foo: (x: RegExp) => string; }): any; (x: { foo: (x: RegExp) => string; }): any; }
>foo4 : { (x: { foo(x: RegExp): string; }): any; (x: { foo(x: RegExp): string; }): any; }
>x : any
function foo5(x: A);
@@ -244,17 +243,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // ok
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
>x : { foo: (x: RegExp) => string; }
>b : { foo: (x: RegExp) => string; }
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
>x : { foo(x: RegExp): string; }
>b : { foo(x: RegExp): string; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { foo: (x: RegExp) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: RegExp): string; }): any; }
>x : any
function foo12(x: I);
@@ -300,17 +299,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // ok
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
>x : { foo: (x: RegExp) => string; }
>b : { foo: (x: RegExp) => string; }
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
>x : { foo(x: RegExp): string; }
>b : { foo(x: RegExp): string; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { foo: (x: RegExp) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: RegExp): string; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -57,10 +57,9 @@ var a: { foo(x: string, y: string): string }
>y : string
var b = { foo(x: string) { return ''; } };
>b : { foo: (x: string) => string; }
>{ foo(x: string) { return ''; } } : { foo: (x: string) => string; }
>b : { foo(x: string): string; }
>{ foo(x: string) { return ''; } } : { foo(x: string): string; }
>foo : (x: string) => string
>foo(x: string) { return ''; } : (x: string) => string
>x : string
function foo1(x: A);
@@ -134,17 +133,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo4(x: any) { }
>foo4 : { (x: { foo: (x: string) => string; }): any; (x: { foo: (x: string) => string; }): any; }
>foo4 : { (x: { foo(x: string): string; }): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo5(x: A);
@@ -246,17 +245,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // ok
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { foo: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo12(x: I);
@@ -302,17 +301,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // error
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>x : { foo: (x: string) => string; }
>b : { foo: (x: string) => string; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : { foo(x: string): string; }
>b : { foo(x: string): string; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { foo: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: string): string; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -100,12 +100,11 @@ var a: {
}
var b = {
>b : { foo: (x: any) => any; }
>{ foo(x: any) { return <any>''; }} : { foo: (x: any) => any; }
>b : { foo(x: any): any; }
>{ foo(x: any) { return <any>''; }} : { foo(x: any): any; }
foo(x: any) { return <any>''; }
>foo : (x: any) => any
>foo(x: any) { return <any>''; } : (x: any) => any
>x : any
><any>'' : any
@@ -182,17 +181,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
>x : { foo: (x: any) => any; }
>b : { foo: (x: any) => any; }
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
>x : { foo(x: any): any; }
>b : { foo(x: any): any; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
>x : { foo: (x: any) => any; }
>b : { foo: (x: any) => any; }
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
>x : { foo(x: any): any; }
>b : { foo(x: any): any; }
function foo4(x: any) { }
>foo4 : { (x: { foo: (x: any) => any; }): any; (x: { foo: (x: any) => any; }): any; }
>foo4 : { (x: { foo(x: any): any; }): any; (x: { foo(x: any): any; }): any; }
>x : any
function foo5(x: A);
@@ -294,17 +293,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // ok
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
>x : { foo: (x: any) => any; }
>b : { foo: (x: any) => any; }
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
>x : { foo(x: any): any; }
>b : { foo(x: any): any; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { foo: (x: any) => any; }): any; }
>foo11 : { (x: B): any; (x: { foo(x: any): any; }): any; }
>x : any
function foo12(x: I);
@@ -350,17 +349,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // ok
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
>x : { foo: (x: any) => any; }
>b : { foo: (x: any) => any; }
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
>x : { foo(x: any): any; }
>b : { foo(x: any): any; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { foo: (x: any) => any; }): any; }
>foo14 : { (x: I): any; (x: { foo(x: any): any; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -40,10 +40,9 @@ var a: { new(x: Date): string }
>Date : Date
var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new
>b : { new: (x: RegExp) => string; }
>{ new(x: RegExp) { return ''; } } : { new: (x: RegExp) => string; }
>b : { new(x: RegExp): string; }
>{ new(x: RegExp) { return ''; } } : { new(x: RegExp): string; }
>new : (x: RegExp) => string
>new(x: RegExp) { return ''; } : (x: RegExp) => string
>x : RegExp
>RegExp : RegExp
@@ -104,17 +103,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
>x : { new: (x: RegExp) => string; }
>b : { new: (x: RegExp) => string; }
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
>x : { new(x: RegExp): string; }
>b : { new(x: RegExp): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
>x : { new: (x: RegExp) => string; }
>b : { new: (x: RegExp) => string; }
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
>x : { new(x: RegExp): string; }
>b : { new(x: RegExp): string; }
function foo4(x: any) { }
>foo4 : { (x: { new: (x: RegExp) => string; }): any; (x: { new: (x: RegExp) => string; }): any; }
>foo4 : { (x: { new(x: RegExp): string; }): any; (x: { new(x: RegExp): string; }): any; }
>x : any
function foo8(x: B);
@@ -160,17 +159,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // ok
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
>x : { new: (x: RegExp) => string; }
>b : { new: (x: RegExp) => string; }
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
>x : { new(x: RegExp): string; }
>b : { new(x: RegExp): string; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { new: (x: RegExp) => string; }): any; }
>foo11 : { (x: B): any; (x: { new(x: RegExp): string; }): any; }
>x : any
function foo12(x: I);
@@ -216,17 +215,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // ok
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
>x : { new: (x: RegExp) => string; }
>b : { new: (x: RegExp) => string; }
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
>x : { new(x: RegExp): string; }
>b : { new(x: RegExp): string; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { new: (x: RegExp) => string; }): any; }
>foo14 : { (x: I): any; (x: { new(x: RegExp): string; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -43,10 +43,9 @@ var a: { new(x: string, y: string): string }
>y : string
var b = { new(x: string) { return ''; } }; // not a construct signature, function called new
>b : { new: (x: string) => string; }
>{ new(x: string) { return ''; } } : { new: (x: string) => string; }
>b : { new(x: string): string; }
>{ new(x: string) { return ''; } } : { new(x: string): string; }
>new : (x: string) => string
>new(x: string) { return ''; } : (x: string) => string
>x : string
function foo1b(x: B);
@@ -106,17 +105,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
>x : { new: (x: string) => string; }
>b : { new: (x: string) => string; }
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
>x : { new(x: string): string; }
>b : { new(x: string): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
>x : { new: (x: string) => string; }
>b : { new: (x: string) => string; }
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
>x : { new(x: string): string; }
>b : { new(x: string): string; }
function foo4(x: any) { }
>foo4 : { (x: { new: (x: string) => string; }): any; (x: { new: (x: string) => string; }): any; }
>foo4 : { (x: { new(x: string): string; }): any; (x: { new(x: string): string; }): any; }
>x : any
function foo8(x: B);
@@ -162,17 +161,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B);
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
>x : B
>B : B
function foo11(x: typeof b); // ok
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
>x : { new: (x: string) => string; }
>b : { new: (x: string) => string; }
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
>x : { new(x: string): string; }
>b : { new(x: string): string; }
function foo11(x: any) { }
>foo11 : { (x: B): any; (x: { new: (x: string) => string; }): any; }
>foo11 : { (x: B): any; (x: { new(x: string): string; }): any; }
>x : any
function foo12(x: I);
@@ -218,17 +217,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I);
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
>x : I
>I : I
function foo14(x: typeof b); // ok
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
>x : { new: (x: string) => string; }
>b : { new: (x: string) => string; }
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
>x : { new(x: string): string; }
>b : { new(x: string): string; }
function foo14(x: any) { }
>foo14 : { (x: I): any; (x: { new: (x: string) => string; }): any; }
>foo14 : { (x: I): any; (x: { new(x: string): string; }): any; }
>x : any
function foo15(x: I2<string>);
@@ -65,10 +65,9 @@ var a: { foo<T>(x: T): T }
>T : T
var b = { foo<T>(x: T) { return x; } };
>b : { foo: <T>(x: T) => T; }
>{ foo<T>(x: T) { return x; } } : { foo: <T>(x: T) => T; }
>b : { foo<T>(x: T): T; }
>{ foo<T>(x: T) { return x; } } : { foo<T>(x: T): T; }
>foo : <T>(x: T) => T
>foo<T>(x: T) { return x; } : <T>(x: T) => T
>T : T
>x : T
>T : T
@@ -145,17 +144,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
>x : { foo: <T>(x: T) => T; }
>b : { foo: <T>(x: T) => T; }
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
>x : { foo: <T>(x: T) => T; }
>b : { foo: <T>(x: T) => T; }
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T>(x: T) => T; }): any; (x: { foo: <T>(x: T) => T; }): any; }
>foo4 : { (x: { foo<T>(x: T): T; }): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo5(x: A);
@@ -257,17 +256,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>x : { foo: <T>(x: T) => T; }
>b : { foo: <T>(x: T) => T; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo12(x: I<string>);
@@ -313,17 +312,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>x : { foo: <T>(x: T) => T; }
>b : { foo: <T>(x: T) => T; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : { foo<T>(x: T): T; }
>b : { foo<T>(x: T): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): T; }): any; }
>x : any
function foo15(x: I2);
@@ -83,10 +83,9 @@ var a: { foo<T, U>(x: T, y: U): T }
>T : T
var b = { foo<T, U>(x: T, y: U) { return x; } };
>b : { foo: <T, U>(x: T, y: U) => T; }
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo<T, U>(x: T, y: U): T; }
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo<T, U>(x: T, y: U): T; }
>foo : <T, U>(x: T, y: U) => T
>foo<T, U>(x: T, y: U) { return x; } : <T, U>(x: T, y: U) => T
>T : T
>U : U
>x : T
@@ -166,17 +165,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo5(x: A);
@@ -278,17 +277,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, number>);
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : B<string, number>
>B : B<T, U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo12(x: I<string, number>);
@@ -334,17 +333,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, number>);
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : I<string, number>
>I : I<T, U>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo15(x: I2);
@@ -67,10 +67,9 @@ var a: { foo<T extends Array<string>>(x: T): string }
>T : T
var b = { foo<T extends RegExp>(x: T) { return ''; } };
>b : { foo: <T extends RegExp>(x: T) => string; }
>{ foo<T extends RegExp>(x: T) { return ''; } } : { foo: <T extends RegExp>(x: T) => string; }
>b : { foo<T extends RegExp>(x: T): string; }
>{ foo<T extends RegExp>(x: T) { return ''; } } : { foo<T extends RegExp>(x: T): string; }
>foo : <T extends RegExp>(x: T) => string
>foo<T extends RegExp>(x: T) { return ''; } : <T extends RegExp>(x: T) => string
>T : T
>RegExp : RegExp
>x : T
@@ -153,17 +152,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>x : { foo: <T extends RegExp>(x: T) => string; }
>b : { foo: <T extends RegExp>(x: T) => string; }
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : { foo<T extends RegExp>(x: T): string; }
>b : { foo<T extends RegExp>(x: T): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>x : { foo: <T extends RegExp>(x: T) => string; }
>b : { foo: <T extends RegExp>(x: T) => string; }
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : { foo<T extends RegExp>(x: T): string; }
>b : { foo<T extends RegExp>(x: T): string; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T extends RegExp>(x: T) => string; }): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>foo4 : { (x: { foo<T extends RegExp>(x: T): string; }): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : any
function foo5(x: A);
@@ -273,18 +272,18 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<Array<number>>);
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : B<number[]>
>B : B<T>
>Array : T[]
function foo11(x: typeof b); // ok
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>x : { foo: <T extends RegExp>(x: T) => string; }
>b : { foo: <T extends RegExp>(x: T) => string; }
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : { foo<T extends RegExp>(x: T): string; }
>b : { foo<T extends RegExp>(x: T): string; }
function foo11(x: any) { }
>foo11 : { (x: B<number[]>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>foo11 : { (x: B<number[]>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : any
function foo12(x: I<Number>);
@@ -334,18 +333,18 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<Number>);
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : I<Number>
>I : I<T>
>Number : Number
function foo14(x: typeof b); // ok
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>x : { foo: <T extends RegExp>(x: T) => string; }
>b : { foo: <T extends RegExp>(x: T) => string; }
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : { foo<T extends RegExp>(x: T): string; }
>b : { foo<T extends RegExp>(x: T): string; }
function foo14(x: any) { }
>foo14 : { (x: I<Number>): any; (x: { foo: <T extends RegExp>(x: T) => string; }): any; }
>foo14 : { (x: I<Number>): any; (x: { foo<T extends RegExp>(x: T): string; }): any; }
>x : any
function foo15(x: I2);
@@ -64,10 +64,9 @@ var a: { foo<T>(x: T): T }
>T : T
var b = { foo<T>(x: T) { return null; } };
>b : { foo: <T>(x: T) => any; }
>{ foo<T>(x: T) { return null; } } : { foo: <T>(x: T) => any; }
>b : { foo<T>(x: T): any; }
>{ foo<T>(x: T) { return null; } } : { foo<T>(x: T): any; }
>foo : <T>(x: T) => any
>foo<T>(x: T) { return null; } : <T>(x: T) => any
>T : T
>x : T
>T : T
@@ -143,17 +142,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
>x : { foo: <T>(x: T) => any; }
>b : { foo: <T>(x: T) => any; }
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
>x : { foo<T>(x: T): any; }
>b : { foo<T>(x: T): any; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
>x : { foo: <T>(x: T) => any; }
>b : { foo: <T>(x: T) => any; }
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
>x : { foo<T>(x: T): any; }
>b : { foo<T>(x: T): any; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T>(x: T) => any; }): any; (x: { foo: <T>(x: T) => any; }): any; }
>foo4 : { (x: { foo<T>(x: T): any; }): any; (x: { foo<T>(x: T): any; }): any; }
>x : any
function foo5(x: A);
@@ -255,17 +254,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>x : { foo: <T>(x: T) => any; }
>b : { foo: <T>(x: T) => any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : { foo<T>(x: T): any; }
>b : { foo<T>(x: T): any; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : any
function foo12(x: I<string>);
@@ -311,17 +310,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>x : { foo: <T>(x: T) => any; }
>b : { foo: <T>(x: T) => any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : { foo<T>(x: T): any; }
>b : { foo<T>(x: T): any; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T) => any; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T): any; }): any; }
>x : any
function foo15(x: I2);
@@ -70,10 +70,9 @@ var a: { foo<T extends Date>(x: T): T }
>T : T
var b = { foo<T extends Date>(x: T) { return null; } };
>b : { foo: <T extends Date>(x: T) => any; }
>{ foo<T extends Date>(x: T) { return null; } } : { foo: <T extends Date>(x: T) => any; }
>b : { foo<T extends Date>(x: T): any; }
>{ foo<T extends Date>(x: T) { return null; } } : { foo<T extends Date>(x: T): any; }
>foo : <T extends Date>(x: T) => any
>foo<T extends Date>(x: T) { return null; } : <T extends Date>(x: T) => any
>T : T
>Date : Date
>x : T
@@ -156,17 +155,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>x : { foo: <T extends Date>(x: T) => any; }
>b : { foo: <T extends Date>(x: T) => any; }
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : { foo<T extends Date>(x: T): any; }
>b : { foo<T extends Date>(x: T): any; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>x : { foo: <T extends Date>(x: T) => any; }
>b : { foo: <T extends Date>(x: T) => any; }
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : { foo<T extends Date>(x: T): any; }
>b : { foo<T extends Date>(x: T): any; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T extends Date>(x: T) => any; }): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>foo4 : { (x: { foo<T extends Date>(x: T): any; }): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : any
function foo5(x: A);
@@ -276,18 +275,18 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<Date>);
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : B<Date>
>B : B<T>
>Date : Date
function foo11(x: typeof b); // ok
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>x : { foo: <T extends Date>(x: T) => any; }
>b : { foo: <T extends Date>(x: T) => any; }
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : { foo<T extends Date>(x: T): any; }
>b : { foo<T extends Date>(x: T): any; }
function foo11(x: any) { }
>foo11 : { (x: B<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>foo11 : { (x: B<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : any
function foo12(x: I<Date>);
@@ -337,18 +336,18 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<Date>);
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : I<Date>
>I : I<T>
>Date : Date
function foo14(x: typeof b); // ok
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>x : { foo: <T extends Date>(x: T) => any; }
>b : { foo: <T extends Date>(x: T) => any; }
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : { foo<T extends Date>(x: T): any; }
>b : { foo<T extends Date>(x: T): any; }
function foo14(x: any) { }
>foo14 : { (x: I<Date>): any; (x: { foo: <T extends Date>(x: T) => any; }): any; }
>foo14 : { (x: I<Date>): any; (x: { foo<T extends Date>(x: T): any; }): any; }
>x : any
function foo15(x: I2);
@@ -78,10 +78,9 @@ var a: { foo<Z, A, B, C, D>(x: Z): Z }
>Z : Z
var b = { foo<A, B, C, D, E, F>(x: A) { return x; } };
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
>{ foo<A, B, C, D, E, F>(x: A) { return x; } } : { foo: <A, B, C, D, E, F>(x: A) => A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
>{ foo<A, B, C, D, E, F>(x: A) { return x; } } : { foo<A, B, C, D, E, F>(x: A): A; }
>foo : <A, B, C, D, E, F>(x: A) => A
>foo<A, B, C, D, E, F>(x: A) { return x; } : <A, B, C, D, E, F>(x: A) => A
>A : A
>B : B
>C : C
@@ -163,17 +162,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo4 : { (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo5(x: A);
@@ -278,17 +277,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, boolean>);
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : B<string, boolean>
>B : B<U, V>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo11(x: any) { }
>foo11 : { (x: B<string, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo11 : { (x: B<string, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo12(x: I<B<string, number>, number, Date, string>);
@@ -341,19 +340,19 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, Date, RegExp, boolean>);
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : I<string, Date, RegExp, boolean>
>I : I<X, Y, Z, A>
>Date : Date
>RegExp : RegExp
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { foo: <A, B, C, D, E, F>(x: A) => A; }
>b : { foo: <A, B, C, D, E, F>(x: A) => A; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { foo<A, B, C, D, E, F>(x: A): A; }
>b : { foo<A, B, C, D, E, F>(x: A): A; }
function foo14(x: any) { }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { foo<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo15(x: I2);
@@ -65,10 +65,9 @@ var a: { foo<Z>(x: Z): Z }
>Z : Z
var b = { foo<A>(x: A) { return x; } };
>b : { foo: <A>(x: A) => A; }
>{ foo<A>(x: A) { return x; } } : { foo: <A>(x: A) => A; }
>b : { foo<A>(x: A): A; }
>{ foo<A>(x: A) { return x; } } : { foo<A>(x: A): A; }
>foo : <A>(x: A) => A
>foo<A>(x: A) { return x; } : <A>(x: A) => A
>A : A
>x : A
>A : A
@@ -145,17 +144,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
>x : { foo: <A>(x: A) => A; }
>b : { foo: <A>(x: A) => A; }
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
>x : { foo<A>(x: A): A; }
>b : { foo<A>(x: A): A; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
>x : { foo: <A>(x: A) => A; }
>b : { foo: <A>(x: A) => A; }
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
>x : { foo<A>(x: A): A; }
>b : { foo<A>(x: A): A; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <A>(x: A) => A; }): any; (x: { foo: <A>(x: A) => A; }): any; }
>foo4 : { (x: { foo<A>(x: A): A; }): any; (x: { foo<A>(x: A): A; }): any; }
>x : any
function foo5(x: A);
@@ -257,17 +256,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : B<string>
>B : B<U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>x : { foo: <A>(x: A) => A; }
>b : { foo: <A>(x: A) => A; }
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : { foo<A>(x: A): A; }
>b : { foo<A>(x: A): A; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : any
function foo12(x: I<string>);
@@ -313,17 +312,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : I<string>
>I : I<X>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>x : { foo: <A>(x: A) => A; }
>b : { foo: <A>(x: A) => A; }
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : { foo<A>(x: A): A; }
>b : { foo<A>(x: A): A; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { foo: <A>(x: A) => A; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<A>(x: A): A; }): any; }
>x : any
function foo15(x: I2);
@@ -79,10 +79,9 @@ var a: { foo<T>(x: T, y?: T): T }
>T : T
var b = { foo<T>(x: T, y?: T) { return x; } };
>b : { foo: <T>(x: T, y?: T) => T; }
>{ foo<T>(x: T, y?: T) { return x; } } : { foo: <T>(x: T, y?: T) => T; }
>b : { foo<T>(x: T, y?: T): T; }
>{ foo<T>(x: T, y?: T) { return x; } } : { foo<T>(x: T, y?: T): T; }
>foo : <T>(x: T, y?: T) => T
>foo<T>(x: T, y?: T) { return x; } : <T>(x: T, y?: T) => T
>T : T
>x : T
>T : T
@@ -161,17 +160,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>x : { foo: <T>(x: T, y?: T) => T; }
>b : { foo: <T>(x: T, y?: T) => T; }
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : { foo<T>(x: T, y?: T): T; }
>b : { foo<T>(x: T, y?: T): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>x : { foo: <T>(x: T, y?: T) => T; }
>b : { foo: <T>(x: T, y?: T) => T; }
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : { foo<T>(x: T, y?: T): T; }
>b : { foo<T>(x: T, y?: T): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T>(x: T, y?: T) => T; }): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>foo4 : { (x: { foo<T>(x: T, y?: T): T; }): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : any
function foo5(x: A);
@@ -273,17 +272,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>x : { foo: <T>(x: T, y?: T) => T; }
>b : { foo: <T>(x: T, y?: T) => T; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : { foo<T>(x: T, y?: T): T; }
>b : { foo<T>(x: T, y?: T): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : any
function foo12(x: I<string>);
@@ -329,17 +328,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>x : { foo: <T>(x: T, y?: T) => T; }
>b : { foo: <T>(x: T, y?: T) => T; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : { foo<T>(x: T, y?: T): T; }
>b : { foo<T>(x: T, y?: T): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { foo: <T>(x: T, y?: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { foo<T>(x: T, y?: T): T; }): any; }
>x : any
function foo15(x: I2);
@@ -85,10 +85,9 @@ var a: { foo<T, U>(x: T, y?: U): T }
>T : T
var b = { foo<T, U>(x: T, y?: U) { return x; } };
>b : { foo: <T, U>(x: T, y?: U) => T; }
>{ foo<T, U>(x: T, y?: U) { return x; } } : { foo: <T, U>(x: T, y?: U) => T; }
>b : { foo<T, U>(x: T, y?: U): T; }
>{ foo<T, U>(x: T, y?: U) { return x; } } : { foo<T, U>(x: T, y?: U): T; }
>foo : <T, U>(x: T, y?: U) => T
>foo<T, U>(x: T, y?: U) { return x; } : <T, U>(x: T, y?: U) => T
>T : T
>U : U
>x : T
@@ -168,17 +167,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y?: U) => T; }
>b : { foo: <T, U>(x: T, y?: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : { foo<T, U>(x: T, y?: U): T; }
>b : { foo<T, U>(x: T, y?: U): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y?: U) => T; }
>b : { foo: <T, U>(x: T, y?: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : { foo<T, U>(x: T, y?: U): T; }
>b : { foo<T, U>(x: T, y?: U): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T, U>(x: T, y?: U) => T; }): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>foo4 : { (x: { foo<T, U>(x: T, y?: U): T; }): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : any
function foo5(x: A);
@@ -280,17 +279,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, number>);
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : B<string, number>
>B : B<T, U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y?: U) => T; }
>b : { foo: <T, U>(x: T, y?: U) => T; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : { foo<T, U>(x: T, y?: U): T; }
>b : { foo<T, U>(x: T, y?: U): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : any
function foo12(x: I<string, number>);
@@ -336,17 +335,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, number>);
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : I<string, number>
>I : I<T, U>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y?: U) => T; }
>b : { foo: <T, U>(x: T, y?: U) => T; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : { foo<T, U>(x: T, y?: U): T; }
>b : { foo<T, U>(x: T, y?: U): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y?: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y?: U): T; }): any; }
>x : any
function foo15(x: I2);
@@ -85,10 +85,9 @@ var a: { foo<T, U>(x: T, y?: U): T }
>T : T
var b = { foo<T, U>(x: T, y: U) { return x; } };
>b : { foo: <T, U>(x: T, y: U) => T; }
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo<T, U>(x: T, y: U): T; }
>{ foo<T, U>(x: T, y: U) { return x; } } : { foo<T, U>(x: T, y: U): T; }
>foo : <T, U>(x: T, y: U) => T
>foo<T, U>(x: T, y: U) { return x; } : <T, U>(x: T, y: U) => T
>T : T
>U : U
>x : T
@@ -168,17 +167,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo4(x: any) { }
>foo4 : { (x: { foo: <T, U>(x: T, y: U) => T; }): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo4 : { (x: { foo<T, U>(x: T, y: U): T; }): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo5(x: A);
@@ -280,17 +279,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, number>);
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : B<string, number>
>B : B<T, U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo12(x: I<string, number>);
@@ -336,17 +335,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, number>);
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : I<string, number>
>I : I<T, U>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>x : { foo: <T, U>(x: T, y: U) => T; }
>b : { foo: <T, U>(x: T, y: U) => T; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : { foo<T, U>(x: T, y: U): T; }
>b : { foo<T, U>(x: T, y: U): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string, number>): any; (x: { foo: <T, U>(x: T, y: U) => T; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { foo<T, U>(x: T, y: U): T; }): any; }
>x : any
function foo15(x: I2);
@@ -51,10 +51,9 @@ var a: { new<T extends Array<string>>(x: T): string }
>T : T
var b = { new<T extends RegExp>(x: T) { return ''; } }; // not a construct signature, function called new
>b : { new: <T extends RegExp>(x: T) => string; }
>{ new<T extends RegExp>(x: T) { return ''; } } : { new: <T extends RegExp>(x: T) => string; }
>b : { new<T extends RegExp>(x: T): string; }
>{ new<T extends RegExp>(x: T) { return ''; } } : { new<T extends RegExp>(x: T): string; }
>new : <T extends RegExp>(x: T) => string
>new<T extends RegExp>(x: T) { return ''; } : <T extends RegExp>(x: T) => string
>T : T
>RegExp : RegExp
>x : T
@@ -123,17 +122,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>x : { new: <T extends RegExp>(x: T) => string; }
>b : { new: <T extends RegExp>(x: T) => string; }
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : { new<T extends RegExp>(x: T): string; }
>b : { new<T extends RegExp>(x: T): string; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>x : { new: <T extends RegExp>(x: T) => string; }
>b : { new: <T extends RegExp>(x: T) => string; }
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : { new<T extends RegExp>(x: T): string; }
>b : { new<T extends RegExp>(x: T): string; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T extends RegExp>(x: T) => string; }): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>foo4 : { (x: { new<T extends RegExp>(x: T): string; }): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : any
function foo8(x: B<Array<number>>);
@@ -184,18 +183,18 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<Array<number>>);
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : B<number[]>
>B : B<T>
>Array : T[]
function foo11(x: typeof b); // ok
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>x : { new: <T extends RegExp>(x: T) => string; }
>b : { new: <T extends RegExp>(x: T) => string; }
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : { new<T extends RegExp>(x: T): string; }
>b : { new<T extends RegExp>(x: T): string; }
function foo11(x: any) { }
>foo11 : { (x: B<number[]>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>foo11 : { (x: B<number[]>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : any
function foo12(x: I<Number>);
@@ -245,17 +244,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<Number>);
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : I<Number>
>I : I<T>
>Number : Number
function foo14(x: typeof b); // ok
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>x : { new: <T extends RegExp>(x: T) => string; }
>b : { new: <T extends RegExp>(x: T) => string; }
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : { new<T extends RegExp>(x: T): string; }
>b : { new<T extends RegExp>(x: T): string; }
function foo14(x: any) { }
>foo14 : { (x: I<Number>): any; (x: { new: <T extends RegExp>(x: T) => string; }): any; }
>foo14 : { (x: I<Number>): any; (x: { new<T extends RegExp>(x: T): string; }): any; }
>x : any
@@ -49,10 +49,9 @@ var a: { new<T>(x: T): T }
>T : T
var b = { new<T>(x: T): T { return null; } }; // not a construct signature, function called new
>b : { new: <T>(x: T) => T; }
>{ new<T>(x: T): T { return null; } } : { new: <T>(x: T) => T; }
>b : { new<T>(x: T): T; }
>{ new<T>(x: T): T { return null; } } : { new<T>(x: T): T; }
>new : <T>(x: T) => T
>new<T>(x: T): T { return null; } : <T>(x: T) => T
>T : T
>x : T
>T : T
@@ -115,31 +114,31 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
>x : { new: <T>(x: T) => T; }
>b : { new: <T>(x: T) => T; }
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
>x : { new<T>(x: T): T; }
>b : { new<T>(x: T): T; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
>x : { new: <T>(x: T) => T; }
>b : { new: <T>(x: T) => T; }
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
>x : { new<T>(x: T): T; }
>b : { new<T>(x: T): T; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T>(x: T) => T; }): any; (x: { new: <T>(x: T) => T; }): any; }
>foo4 : { (x: { new<T>(x: T): T; }): any; (x: { new<T>(x: T): T; }): any; }
>x : any
function foo5(x: typeof a): number;
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
>x : new <T>(x: T) => T
>a : new <T>(x: T) => T
function foo5(x: typeof b): string; // ok
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
>x : { new: <T>(x: T) => T; }
>b : { new: <T>(x: T) => T; }
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
>x : { new<T>(x: T): T; }
>b : { new<T>(x: T): T; }
function foo5(x: any): any { }
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new: <T>(x: T) => T; }): string; }
>foo5 : { (x: new <T>(x: T) => T): number; (x: { new<T>(x: T): T; }): string; }
>x : any
function foo8(x: B<string>);
@@ -185,17 +184,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>x : { new: <T>(x: T) => T; }
>b : { new: <T>(x: T) => T; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : { new<T>(x: T): T; }
>b : { new<T>(x: T): T; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : any
function foo12(x: I<string>);
@@ -241,17 +240,17 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>x : { new: <T>(x: T) => T; }
>b : { new: <T>(x: T) => T; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : { new<T>(x: T): T; }
>b : { new<T>(x: T): T; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T) => T; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T): T; }): any; }
>x : any
function foo15(x: I2);
@@ -54,10 +54,9 @@ var a: { new<T extends Date>(x: T): T }
>T : T
var b = { new<T extends Date>(x: T) { return null; } }; // not a construct signature, function called new
>b : { new: <T extends Date>(x: T) => any; }
>{ new<T extends Date>(x: T) { return null; } } : { new: <T extends Date>(x: T) => any; }
>b : { new<T extends Date>(x: T): any; }
>{ new<T extends Date>(x: T) { return null; } } : { new<T extends Date>(x: T): any; }
>new : <T extends Date>(x: T) => any
>new<T extends Date>(x: T) { return null; } : <T extends Date>(x: T) => any
>T : T
>Date : Date
>x : T
@@ -126,17 +125,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>x : { new: <T extends Date>(x: T) => any; }
>b : { new: <T extends Date>(x: T) => any; }
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : { new<T extends Date>(x: T): any; }
>b : { new<T extends Date>(x: T): any; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>x : { new: <T extends Date>(x: T) => any; }
>b : { new: <T extends Date>(x: T) => any; }
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : { new<T extends Date>(x: T): any; }
>b : { new<T extends Date>(x: T): any; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T extends Date>(x: T) => any; }): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>foo4 : { (x: { new<T extends Date>(x: T): any; }): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : any
function foo8(x: B<Date>);
@@ -187,18 +186,18 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<Date>);
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : B<Date>
>B : B<T>
>Date : Date
function foo11(x: typeof b); // ok
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>x : { new: <T extends Date>(x: T) => any; }
>b : { new: <T extends Date>(x: T) => any; }
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : { new<T extends Date>(x: T): any; }
>b : { new<T extends Date>(x: T): any; }
function foo11(x: any) { }
>foo11 : { (x: B<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>foo11 : { (x: B<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : any
function foo12(x: I<Date>);
@@ -248,18 +247,18 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<Date>);
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : I<Date>
>I : I<T>
>Date : Date
function foo14(x: typeof b); // ok
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>x : { new: <T extends Date>(x: T) => any; }
>b : { new: <T extends Date>(x: T) => any; }
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : { new<T extends Date>(x: T): any; }
>b : { new<T extends Date>(x: T): any; }
function foo14(x: any) { }
>foo14 : { (x: I<Date>): any; (x: { new: <T extends Date>(x: T) => any; }): any; }
>foo14 : { (x: I<Date>): any; (x: { new<T extends Date>(x: T): any; }): any; }
>x : any
function foo15(x: I2);
@@ -68,10 +68,9 @@ var a: { new <Z, A, B, CC, D>(x: Z): C<Z, A, B>; }
>B : B
var b = { new<A, B, C, D, E, F>(x: A) { return x; } };
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
>{ new<A, B, C, D, E, F>(x: A) { return x; } } : { new: <A, B, C, D, E, F>(x: A) => A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }
>{ new<A, B, C, D, E, F>(x: A) { return x; } } : { new<A, B, C, D, E, F>(x: A): A; }
>new : <A, B, C, D, E, F>(x: A) => A
>new<A, B, C, D, E, F>(x: A) { return x; } : <A, B, C, D, E, F>(x: A) => A
>A : A
>B : B
>C : C
@@ -139,17 +138,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }
function foo4(x: any) { }
>foo4 : { (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo8(x: B<string, string>);
@@ -197,17 +196,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, boolean>);
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : B<string, boolean>
>B : B<U, V>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }
function foo11(x: any) { }
>foo11 : { (x: B<string, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
function foo12(x: I<B<string, number>, number, Date, string>);
@@ -260,18 +259,18 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, Date, RegExp, boolean>);
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : I<string, Date, RegExp, boolean>
>I : I<X, Y, Z, A>
>Date : Date
>RegExp : RegExp
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>x : { new: <A, B, C, D, E, F>(x: A) => A; }
>b : { new: <A, B, C, D, E, F>(x: A) => A; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }
function foo14(x: any) { }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new: <A, B, C, D, E, F>(x: A) => A; }): any; }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any
@@ -50,10 +50,9 @@ var a: { new<Z>(x: Z): B<Z> }
>Z : Z
var b = { new<A>(x: A) { return new C<A>(x); } };
>b : { new: <A>(x: A) => C<A>; }
>{ new<A>(x: A) { return new C<A>(x); } } : { new: <A>(x: A) => C<A>; }
>b : { new<A>(x: A): C<A>; }
>{ new<A>(x: A) { return new C<A>(x); } } : { new<A>(x: A): C<A>; }
>new : <A>(x: A) => C<A>
>new<A>(x: A) { return new C<A>(x); } : <A>(x: A) => C<A>
>A : A
>x : A
>A : A
@@ -119,17 +118,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>x : { new: <A>(x: A) => C<A>; }
>b : { new: <A>(x: A) => C<A>; }
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : { new<A>(x: A): C<A>; }
>b : { new<A>(x: A): C<A>; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>x : { new: <A>(x: A) => C<A>; }
>b : { new: <A>(x: A) => C<A>; }
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : { new<A>(x: A): C<A>; }
>b : { new<A>(x: A): C<A>; }
function foo4(x: any) { }
>foo4 : { (x: { new: <A>(x: A) => C<A>; }): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>foo4 : { (x: { new<A>(x: A): C<A>; }): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : any
function foo8(x: B<string>);
@@ -175,17 +174,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : B<string>
>B : B<U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>x : { new: <A>(x: A) => C<A>; }
>b : { new: <A>(x: A) => C<A>; }
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : { new<A>(x: A): C<A>; }
>b : { new<A>(x: A): C<A>; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : any
function foo12(x: I<string>);
@@ -231,16 +230,16 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : I<string>
>I : I<X>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>x : { new: <A>(x: A) => C<A>; }
>b : { new: <A>(x: A) => C<A>; }
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : { new<A>(x: A): C<A>; }
>b : { new<A>(x: A): C<A>; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { new: <A>(x: A) => C<A>; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<A>(x: A): C<A>; }): any; }
>x : any
@@ -62,10 +62,9 @@ var a: { new<T>(x: T, y?: T): B<T> }
>T : T
var b = { new<T>(x: T, y?: T) { return new C<T>(x, y); } }; // not a construct signature, function called new
>b : { new: <T>(x: T, y?: T) => C<T>; }
>{ new<T>(x: T, y?: T) { return new C<T>(x, y); } } : { new: <T>(x: T, y?: T) => C<T>; }
>b : { new<T>(x: T, y?: T): C<T>; }
>{ new<T>(x: T, y?: T) { return new C<T>(x, y); } } : { new<T>(x: T, y?: T): C<T>; }
>new : <T>(x: T, y?: T) => C<T>
>new<T>(x: T, y?: T) { return new C<T>(x, y); } : <T>(x: T, y?: T) => C<T>
>T : T
>x : T
>T : T
@@ -134,17 +133,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>x : { new: <T>(x: T, y?: T) => C<T>; }
>b : { new: <T>(x: T, y?: T) => C<T>; }
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : { new<T>(x: T, y?: T): C<T>; }
>b : { new<T>(x: T, y?: T): C<T>; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>x : { new: <T>(x: T, y?: T) => C<T>; }
>b : { new: <T>(x: T, y?: T) => C<T>; }
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : { new<T>(x: T, y?: T): C<T>; }
>b : { new<T>(x: T, y?: T): C<T>; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T>(x: T, y?: T) => C<T>; }): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>foo4 : { (x: { new<T>(x: T, y?: T): C<T>; }): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : any
function foo8(x: B<string>): string;
@@ -190,17 +189,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string>);
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : B<string>
>B : B<T>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>x : { new: <T>(x: T, y?: T) => C<T>; }
>b : { new: <T>(x: T, y?: T) => C<T>; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : { new<T>(x: T, y?: T): C<T>; }
>b : { new<T>(x: T, y?: T): C<T>; }
function foo11(x: any) { }
>foo11 : { (x: B<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>foo11 : { (x: B<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : any
function foo12(x: I<string>);
@@ -246,16 +245,16 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string>);
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : I<string>
>I : I<T>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>x : { new: <T>(x: T, y?: T) => C<T>; }
>b : { new: <T>(x: T, y?: T) => C<T>; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : { new<T>(x: T, y?: T): C<T>; }
>b : { new<T>(x: T, y?: T): C<T>; }
function foo14(x: any) { }
>foo14 : { (x: I<string>): any; (x: { new: <T>(x: T, y?: T) => C<T>; }): any; }
>foo14 : { (x: I<string>): any; (x: { new<T>(x: T, y?: T): C<T>; }): any; }
>x : any
@@ -70,10 +70,9 @@ var a: { new<T, U>(x: T, y?: U): B<T,U> }
>U : U
var b = { new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } }; // not a construct signature, function called new
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>{ new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } } : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
>{ new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } } : { new<T, U>(x: T, y?: U): C<T, U>; }
>new : <T, U>(x: T, y?: U) => C<T, U>
>new<T, U>(x: T, y?: U) { return new C<T, U>(x, y); } : <T, U>(x: T, y?: U) => C<T, U>
>T : T
>U : U
>x : T
@@ -144,17 +143,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>foo4 : { (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : any
function foo8(x: B<string, number>);
@@ -200,17 +199,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, number>);
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : B<string, number>
>B : B<T, U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
function foo11(x: any) { }
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : any
function foo12(x: I<string, number>);
@@ -256,16 +255,16 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, number>);
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : I<string, number>
>I : I<T, U>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y?: U) => C<T, U>; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y?: U): C<T, U>; }
>b : { new<T, U>(x: T, y?: U): C<T, U>; }
function foo14(x: any) { }
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y?: U) => C<T, U>; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y?: U): C<T, U>; }): any; }
>x : any
@@ -70,10 +70,9 @@ var a: { new <T, U>(x: T, y?: U): B<T, U> };
>U : U
var b = { new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } }; // not a construct signature, function called new
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
>{ new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } } : { new: <T, U>(x: T, y: U) => C<T, U>; }
>b : { new<T, U>(x: T, y: U): C<T, U>; }
>{ new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } } : { new<T, U>(x: T, y: U): C<T, U>; }
>new : <T, U>(x: T, y: U) => C<T, U>
>new<T, U>(x: T, y: U) { return new C<T, U>(x, y); } : <T, U>(x: T, y: U) => C<T, U>
>T : T
>U : U
>x : T
@@ -144,17 +143,17 @@ function foo3(x: any) { }
>x : any
function foo4(x: typeof b);
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y: U): C<T, U>; }
>b : { new<T, U>(x: T, y: U): C<T, U>; }
function foo4(x: typeof b); // error
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y: U): C<T, U>; }
>b : { new<T, U>(x: T, y: U): C<T, U>; }
function foo4(x: any) { }
>foo4 : { (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>foo4 : { (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : any
function foo8(x: B<string, number>);
@@ -200,17 +199,17 @@ function foo10(x: any) { }
>x : any
function foo11(x: B<string, number>);
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : B<string, number>
>B : B<T, U>
function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y: U): C<T, U>; }
>b : { new<T, U>(x: T, y: U): C<T, U>; }
function foo11(x: any) { }
>foo11 : { (x: B<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>foo11 : { (x: B<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : any
function foo12(x: I<string, number>);
@@ -256,16 +255,16 @@ function foo13(x: any) { }
>x : any
function foo14(x: I<string, number>);
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : I<string, number>
>I : I<T, U>
function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>x : { new: <T, U>(x: T, y: U) => C<T, U>; }
>b : { new: <T, U>(x: T, y: U) => C<T, U>; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : { new<T, U>(x: T, y: U): C<T, U>; }
>b : { new<T, U>(x: T, y: U): C<T, U>; }
function foo14(x: any) { }
>foo14 : { (x: I<string, number>): any; (x: { new: <T, U>(x: T, y: U) => C<T, U>; }): any; }
>foo14 : { (x: I<string, number>): any; (x: { new<T, U>(x: T, y: U): C<T, U>; }): any; }
>x : any
@@ -58,12 +58,11 @@ var a: {
}
var b = {
>b : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; }
>{ foo(x) { return x; }, a: function foo(x) { return x; }, b: (x) => x} : { foo: (x: any) => any; a: (x: any) => any; b: (x: any) => any; }
>b : { foo(x: any): any; a: (x: any) => any; b: (x: any) => any; }
>{ foo(x) { return x; }, a: function foo(x) { return x; }, b: (x) => x} : { foo(x: any): any; a: (x: any) => any; b: (x: any) => any; }
foo(x) {
>foo : (x: any) => any
>foo(x) { return x; } : (x: any) => any
>x : any
return x;
@@ -2,5 +2,5 @@
var v = { [e]() { } };
//// [parserComputedPropertyName3.js]
var v = { [e]: function () {
var v = { [e]() {
} };
@@ -3,5 +3,4 @@ var v = { [e]() { } };
>v : {}
>{ [e]() { } } : {}
>e : unknown
>[e]() { } : () => void
@@ -1,7 +1,6 @@
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment1.ts ===
var v = { foo() { } };
>v : { foo: () => void; }
>{ foo() { } } : { foo: () => void; }
>v : { foo(): void; }
>{ foo() { } } : { foo(): void; }
>foo : () => void
>foo() { } : () => void
@@ -1,6 +1,5 @@
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment2.ts ===
var v = { 0() { } };
>v : { 0: () => void; }
>{ 0() { } } : { 0: () => void; }
>0() { } : () => void
>v : { 0(): void; }
>{ 0() { } } : { 0(): void; }
@@ -1,6 +1,5 @@
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment3.ts ===
var v = { "foo"() { } };
>v : { "foo": () => void; }
>{ "foo"() { } } : { "foo": () => void; }
>"foo"() { } : () => void
>v : { "foo"(): void; }
>{ "foo"() { } } : { "foo"(): void; }
@@ -1,7 +1,6 @@
=== tests/cases/conformance/parser/ecmascript5/PropertyAssignments/parserFunctionPropertyAssignment4.ts ===
var v = { 0<T>() { } };
>v : { 0: <T>() => void; }
>{ 0<T>() { } } : { 0: <T>() => void; }
>0<T>() { } : <T>() => void
>v : { 0<T>(): void; }
>{ 0<T>() { } } : { 0<T>(): void; }
>T : T
@@ -1,2 +1,2 @@
//// [sourceMapValidationFunctionPropertyAssignment.js.map]
{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC,EAAD;AAAM,CAAC,EAAE,CAAC"}
{"version":3,"file":"sourceMapValidationFunctionPropertyAssignment.js","sourceRoot":"","sources":["sourceMapValidationFunctionPropertyAssignment.ts"],"names":["n"],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AAAKA,CAACA,EAAE,CAAC"}
@@ -15,21 +15,18 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts
4 > ^^^
5 > ^^
6 > ^
7 > ^^
1 >
2 >var
3 > x
4 > =
5 > {
6 > n
7 >
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
5 >Emitted(1, 11) Source(1, 11) + SourceIndex(0)
6 >Emitted(1, 12) Source(1, 12) + SourceIndex(0)
7 >Emitted(1, 14) Source(1, 11) + SourceIndex(0)
---
>>>} };
1 >
@@ -37,12 +34,12 @@ sourceFile:sourceMapValidationFunctionPropertyAssignment.ts
3 > ^^
4 > ^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >n() {
1 >() {
2 >}
3 > }
4 > ;
1 >Emitted(2, 1) Source(1, 17) + SourceIndex(0)
2 >Emitted(2, 2) Source(1, 18) + SourceIndex(0)
1 >Emitted(2, 1) Source(1, 17) + SourceIndex(0) name (n)
2 >Emitted(2, 2) Source(1, 18) + SourceIndex(0) name (n)
3 >Emitted(2, 4) Source(1, 20) + SourceIndex(0)
4 >Emitted(2, 5) Source(1, 21) + SourceIndex(0)
---
@@ -1,7 +1,6 @@
=== tests/cases/compiler/sourceMapValidationFunctionPropertyAssignment.ts ===
var x = { n() { } };
>x : { n: () => void; }
>{ n() { } } : { n: () => void; }
>x : { n(): void; }
>{ n() { } } : { n(): void; }
>n : () => void
>n() { } : () => void
@@ -24,7 +24,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo: () => string; }' is not assignable to type '{ [x: string]: string; }'.
tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
Index signatures are incompatible.
Type 'string | number | MyString | (() => void)' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
@@ -160,7 +160,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon
// error
var b: { [x: string]: string; } = {
~
!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo: () => string; }' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2322: Type '{ [x: string]: string | number | MyString | (() => void); 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Type 'string | number | MyString | (() => void)' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -29,12 +29,11 @@ class MyClass {
//type of 'this' in an object literal property of a function type is Any
var obj = {
>obj : { f: () => any; }
>{ f() { return this.spaaace; }} : { f: () => any; }
>obj : { f(): any; }
>{ f() { return this.spaaace; }} : { f(): any; }
f() {
>f : () => any
>f() { return this.spaaace; } : () => any
return this.spaaace;
>this.spaaace : any
@@ -43,6 +42,6 @@ var obj = {
}
};
var obj: { f: () => any; };
>obj : { f: () => any; }
>obj : { f(): any; }
>f : () => any
@@ -83,15 +83,14 @@ class C<T> {
}
var aa = {
>aa : { id: number; biz: () => void; }
>{ id:12, biz() { throw this; }} : { id: number; biz: () => void; }
>aa : { id: number; biz(): void; }
>{ id:12, biz() { throw this; }} : { id: number; biz(): void; }
id:12,
>id : number
biz() {
>biz : () => void
>biz() { throw this; } : () => void
throw this;
>this : any
@@ -14,13 +14,12 @@ var var1: string | number;
>var1 : string | number
var obj1 = {
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
>{ // Inside method method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; }, get prop() { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string return strOrNum; }, set prop(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string }} : { method: (param: string | number) => string | number; prop: string | number; }
>obj1 : { method(param: string | number): string | number; prop: string | number; }
>{ // Inside method method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; }, get prop() { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string return strOrNum; }, set prop(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string }} : { method(param: string | number): string | number; prop: string | number; }
// Inside method
method(param: string | number) {
>method : (param: string | number) => string | number
>method(param: string | number) { // global vars in function declaration num = typeof var1 === "string" && var1.length; // string // variables in function declaration var var2: string | number; num = typeof var2 === "string" && var2.length; // string // parameters in function declaration num = typeof param === "string" && param.length; // string return strOrNum; } : (param: string | number) => string | number
>param : string | number
// global vars in function declaration
@@ -153,12 +152,12 @@ strOrNum = typeof obj1.method(strOrNum) === "string" && obj1.method(strOrNum);
>typeof obj1.method(strOrNum) : string
>obj1.method(strOrNum) : string | number
>obj1.method : (param: string | number) => string | number
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
>obj1 : { method(param: string | number): string | number; prop: string | number; }
>method : (param: string | number) => string | number
>strOrNum : string | number
>obj1.method(strOrNum) : string | number
>obj1.method : (param: string | number) => string | number
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
>obj1 : { method(param: string | number): string | number; prop: string | number; }
>method : (param: string | number) => string | number
>strOrNum : string | number
@@ -170,9 +169,9 @@ strOrNum = typeof obj1.prop === "string" && obj1.prop;
>typeof obj1.prop === "string" : boolean
>typeof obj1.prop : string
>obj1.prop : string | number
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
>obj1 : { method(param: string | number): string | number; prop: string | number; }
>prop : string | number
>obj1.prop : string | number
>obj1 : { method: (param: string | number) => string | number; prop: string | number; }
>obj1 : { method(param: string | number): string | number; prop: string | number; }
>prop : string | number
+2 -2
View File
@@ -31,7 +31,7 @@ goTo.marker('signatureC');
verify.currentSignatureHelpIs('x(a: number): void');
goTo.marker('completionA');
verify.completionListContains("x", "(property) x: (a: number) => void");
verify.completionListContains("x", "(method) x(a: number): void");
goTo.marker('completionB');
verify.completionListContains("x", "(property) x: (a: number) => void");
@@ -40,7 +40,7 @@ goTo.marker('completionC');
verify.completionListContains("x", "(property) x: (a: number) => void");
goTo.marker('quickInfoA');
verify.quickInfoIs("(property) x: (a: number) => void", undefined);
verify.quickInfoIs("(method) x(a: number): void", undefined);
goTo.marker('quickInfoB');
verify.quickInfoIs("(property) x: (a: number) => void", undefined);