docs/libs/typescript.js
function getDeclarationName(node) {
            if (node.name) {
                if (ts.isAmbientModule(node)) {
                    return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\"";
                }
                if (node.name.kind === 140 /* ComputedPropertyName */) {
                    var nameExpression = node.name.expression;
                    // treat computed property names where expression is string/numeric literal as just string/numeric literal
                    if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
                        return nameExpression.text;
                    }
                    ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
                    return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text);
                }
                return node.name.text;
            }
            switch (node.kind) {
                case 148 /* Constructor */:
                    return "__constructor";
                case 156 /* FunctionType */:
                case 151 /* CallSignature */:
                    return "__call";
                case 157 /* ConstructorType */:
                case 152 /* ConstructSignature */:
                    return "__new";
                case 153 /* IndexSignature */:
                    return "__index";
                case 236 /* ExportDeclaration */:
                    return "__export";
                case 235 /* ExportAssignment */:
                    return node.isExportEquals ? "export=" : "default";
                case 187 /* BinaryExpression */:
                    switch (ts.getSpecialPropertyAssignmentKind(node)) {
                        case 2 /* ModuleExports */:
                            // module.exports = ...
                            return "export=";
                        case 1 /* ExportsProperty */:
                        case 4 /* ThisProperty */:
                            // exports.x = ... or this.y = ...
                            return node.left.name.text;
                        case 3 /* PrototypeProperty */:
                            // className.prototype.methodName = ...
                            return node.left.expression.name.text;
                    }
                    ts.Debug.fail("Unknown binary declaration kind");
                    break;
                case 220 /* FunctionDeclaration */:
                case 221 /* ClassDeclaration */:
                    return node.flags & 512 /* Default */ ? "default" : undefined;
                case 269 /* JSDocFunctionType */:
                    return ts.isJSDocConstructSignature(node) ? "__new" : "__call";
                case 142 /* Parameter */:
                    // Parameters with names are handled at the top of this function.  Parameters
                    // without names can only come from JSDocFunctionTypes.
                    ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */);
                    var functionType = node.parent;
                    var index = ts.indexOf(functionType.parameters, node);
                    return "p" + index;
                case 279 /* JSDocTypedefTag */:
                    var parentNode = node.parent && node.parent.parent;
                    var nameFromParentNode = void 0;
                    if (parentNode && parentNode.kind === 200 /* VariableStatement */) {
                        if (parentNode.declarationList.declarations.length > 0) {
                            var nameIdentifier = parentNode.declarationList.declarations[0].name;
                            if (nameIdentifier.kind === 69 /* Identifier */) {
                                nameFromParentNode = nameIdentifier.text;
                            }
                        }
                    }
                    return nameFromParentNode;
            }
        }
function getDeclarationName(node) {
            if (node.name) {
                if (ts.isAmbientModule(node)) {
                    return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\"";
                }
                if (node.name.kind === 140 /* ComputedPropertyName */) {
                    var nameExpression = node.name.expression;
                    // treat computed property names where expression is string/numeric literal as just string/numeric literal
                    if (ts.isStringOrNumericLiteral(nameExpression.kind)) {
                        return nameExpression.text;
                    }
                    ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression));
                    return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text);
                }
                return node.name.text;
            }
            switch (node.kind) {
                case 148 /* Constructor */:
                    return "__constructor";
                case 156 /* FunctionType */:
                case 151 /* CallSignature */:
                    return "__call";
                case 157 /* ConstructorType */:
                case 152 /* ConstructSignature */:
                    return "__new";
                case 153 /* IndexSignature */:
                    return "__index";
                case 236 /* ExportDeclaration */:
                    return "__export";
                case 235 /* ExportAssignment */:
                    return node.isExportEquals ? "export=" : "default";
                case 187 /* BinaryExpression */:
                    switch (ts.getSpecialPropertyAssignmentKind(node)) {
                        case 2 /* ModuleExports */:
                            // module.exports = ...
                            return "export=";
                        case 1 /* ExportsProperty */:
                        case 4 /* ThisProperty */:
                            // exports.x = ... or this.y = ...
                            return node.left.name.text;
                        case 3 /* PrototypeProperty */:
                            // className.prototype.methodName = ...
                            return node.left.expression.name.text;
                    }
                    ts.Debug.fail("Unknown binary declaration kind");
                    break;
                case 220 /* FunctionDeclaration */:
                case 221 /* ClassDeclaration */:
                    return node.flags & 512 /* Default */ ? "default" : undefined;
                case 269 /* JSDocFunctionType */:
                    return ts.isJSDocConstructSignature(node) ? "__new" : "__call";
                case 142 /* Parameter */:
                    // Parameters with names are handled at the top of this function.  Parameters
                    // without names can only come from JSDocFunctionTypes.
                    ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */);
                    var functionType = node.parent;
                    var index = ts.indexOf(functionType.parameters, node);
                    return "p" + index;
                case 279 /* JSDocTypedefTag */:
                    var parentNode = node.parent && node.parent.parent;
                    var nameFromParentNode = void 0;
                    if (parentNode && parentNode.kind === 200 /* VariableStatement */) {
                        if (parentNode.declarationList.declarations.length > 0) {
                            var nameIdentifier = parentNode.declarationList.declarations[0].name;
                            if (nameIdentifier.kind === 69 /* Identifier */) {
                                nameFromParentNode = nameIdentifier.text;
                            }
                        }
                    }
                    return nameFromParentNode;
            }
        }
function getDeclarationName ( node ) { if ( node . name ) { if ( ts . isAmbientModule ( node ) ) { return ts . isGlobalScopeAugmentation ( node ) ? "__global" : "\"" + node . name . text + "\"" ; } if ( node . name . kind === 140 /* ComputedPropertyName */ ) { var nameExpression = node . name . expression ; // treat computed property names where expression is string/numeric literal as just string/numeric literal if ( ts . isStringOrNumericLiteral ( nameExpression . kind ) ) { return nameExpression . text ; } ts . Debug . assert ( ts . isWellKnownSymbolSyntactically ( nameExpression ) ) ; return ts . getPropertyNameForKnownSymbolName ( nameExpression . name . text ) ; } return node . name . text ; } switch ( node . kind ) { case 148 /* Constructor */ : return "__constructor" ; case 156 /* FunctionType */ : case 151 /* CallSignature */ : return "__call" ; case 157 /* ConstructorType */ : case 152 /* ConstructSignature */ : return "__new" ; case 153 /* IndexSignature */ : return "__index" ; case 236 /* ExportDeclaration */ : return "__export" ; case 235 /* ExportAssignment */ : return node . isExportEquals ? "export=" : "default" ; case 187 /* BinaryExpression */ : switch ( ts . getSpecialPropertyAssignmentKind ( node ) ) { case 2 /* ModuleExports */ : // module.exports = ... return "export=" ; case 1 /* ExportsProperty */ : case 4 /* ThisProperty */ : // exports.x = ... or this.y = ... return node . left . name . text ; case 3 /* PrototypeProperty */ : // className.prototype.methodName = ... return node . left . expression . name . text ; } ts . Debug . fail ( "Unknown binary declaration kind" ) ; break ; case 220 /* FunctionDeclaration */ : case 221 /* ClassDeclaration */ : return node . flags & 512 /* Default */ ? "default" : undefined ; case 269 /* JSDocFunctionType */ : return ts . isJSDocConstructSignature ( node ) ? "__new" : "__call" ; case 142 /* Parameter */ : // Parameters with names are handled at the top of this function.  Parameters // without names can only come from JSDocFunctionTypes. ts . Debug . assert ( node . parent . kind === 269 /* JSDocFunctionType */ ) ; var functionType = node . parent ; var index = ts . indexOf ( functionType . parameters , node ) ; return "p" + index ; case 279 /* JSDocTypedefTag */ : var parentNode = node . parent && node . parent . parent ; var nameFromParentNode = void 0 ; if ( parentNode && parentNode . kind === 200 /* VariableStatement */ ) { if ( parentNode . declarationList . declarations . length > 0 ) { var nameIdentifier = parentNode . declarationList . declarations [ 0 ] . name ; if ( nameIdentifier . kind === 69 /* Identifier */ ) { nameFromParentNode = nameIdentifier . text ; } } } return nameFromParentNode ; } }
Should not be called on a declaration with a computed property name, unless it is a well known Symbol.
Should not be called on a declaration with a computed property name unless it is a well known Symbol .