From 3c9eea2df042df6d695c765320a03e5e69359416 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 14 Nov 2014 16:31:40 -0800 Subject: [PATCH] Update comment. --- src/compiler/checker.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 92d474a6202..c348b10dceb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2966,6 +2966,13 @@ module ts { function getTypefromFunctionOrConstructorTypeNode(node: SignatureDeclaration): Type { var links = getNodeLinks(node); if (!links.resolvedType) { + // For a given function type "<...>(...) => T" we want to generate a type identical + // to: { <...>(...): T } + // + // We do that by making an anonymous type literal node, and then setting the function + // type as its sole member. To the rest of the checker, this type will be + // indistinguishable from an actual type literal you would have gotten had you used + // the long form. var symbol = new Symbol(SymbolFlags.TypeLiteral, "__type"); symbol.members = {}; symbol.members[node.kind === SyntaxKind.FunctionType ? "__call" : "__new"] = node.symbol;