demo/typescript.js
function getJsxElementTagSymbol(node) {
            var flags = 8 /* UnknownElement */;
            var links = getNodeLinks(node);
            if (!links.resolvedSymbol) {
                if (isJsxIntrinsicIdentifier(node.tagName)) {
                    links.resolvedSymbol = lookupIntrinsicTag(node);
                }
                else {
                    links.resolvedSymbol = lookupClassTag(node);
                }
            }
            return links.resolvedSymbol;
            function lookupIntrinsicTag(node) {
                var intrinsicElementsType = getJsxIntrinsicElementsType();
                if (intrinsicElementsType !== unknownType) {
                    // Property case
                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text);
                    if (intrinsicProp) {
                        links.jsxFlags |= 1 /* IntrinsicNamedElement */;
                        return intrinsicProp;
                    }
                    // Intrinsic string indexer case
                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */);
                    if (indexSignatureType) {
                        links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
                        return intrinsicElementsType.symbol;
                    }
                    // Wasn't found
                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements);
                    return unknownSymbol;
                }
                else {
                    if (compilerOptions.noImplicitAny) {
                        error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);
                    }
                }
            }
            function lookupClassTag(node) {
                var valueSymbol = resolveJsxTagName(node);
                // Look up the value in the current scope
                if (valueSymbol && valueSymbol !== unknownSymbol) {
                    links.jsxFlags |= 4 /* ClassElement */;
                    if (valueSymbol.flags & 8388608 /* Alias */) {
                        markAliasSymbolAsReferenced(valueSymbol);
                    }
                }
                return valueSymbol || unknownSymbol;
            }
            function resolveJsxTagName(node) {
                if (node.tagName.kind === 69 /* Identifier */) {
                    var tag = node.tagName;
                    var sym = getResolvedSymbol(tag);
                    return sym.exportSymbol || sym;
                }
                else {
                    return checkQualifiedName(node.tagName).symbol;
                }
            }
        }
function getJsxElementTagSymbol(node) {
            var flags = 8 /* UnknownElement */;
            var links = getNodeLinks(node);
            if (!links.resolvedSymbol) {
                if (isJsxIntrinsicIdentifier(node.tagName)) {
                    links.resolvedSymbol = lookupIntrinsicTag(node);
                }
                else {
                    links.resolvedSymbol = lookupClassTag(node);
                }
            }
            return links.resolvedSymbol;
            function lookupIntrinsicTag(node) {
                var intrinsicElementsType = getJsxIntrinsicElementsType();
                if (intrinsicElementsType !== unknownType) {
                    // Property case
                    var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text);
                    if (intrinsicProp) {
                        links.jsxFlags |= 1 /* IntrinsicNamedElement */;
                        return intrinsicProp;
                    }
                    // Intrinsic string indexer case
                    var indexSignatureType = getIndexTypeOfType(intrinsicElementsType, 0 /* String */);
                    if (indexSignatureType) {
                        links.jsxFlags |= 2 /* IntrinsicIndexedElement */;
                        return intrinsicElementsType.symbol;
                    }
                    // Wasn't found
                    error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements);
                    return unknownSymbol;
                }
                else {
                    if (compilerOptions.noImplicitAny) {
                        error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements);
                    }
                }
            }
            function lookupClassTag(node) {
                var valueSymbol = resolveJsxTagName(node);
                // Look up the value in the current scope
                if (valueSymbol && valueSymbol !== unknownSymbol) {
                    links.jsxFlags |= 4 /* ClassElement */;
                    if (valueSymbol.flags & 8388608 /* Alias */) {
                        markAliasSymbolAsReferenced(valueSymbol);
                    }
                }
                return valueSymbol || unknownSymbol;
            }
            function resolveJsxTagName(node) {
                if (node.tagName.kind === 69 /* Identifier */) {
                    var tag = node.tagName;
                    var sym = getResolvedSymbol(tag);
                    return sym.exportSymbol || sym;
                }
                else {
                    return checkQualifiedName(node.tagName).symbol;
                }
            }
        }
/ Given a JSX opening element or self-closing element, return the symbol of the property that the tag name points to if / this is an intrinsic tag. This might be a named / property of the IntrinsicElements interface, or its string indexer. / If this is a class-based tag (otherwise returns undefined), returns the symbol of the class / type or factory function. / Otherwise, returns unknownSymbol.