(symbol, diagnostic)
| 70051 | ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); |
| 70052 | } |
| 70053 | function getExplicitTypeOfSymbol(symbol, diagnostic) { |
| 70054 | if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { |
| 70055 | return getTypeOfSymbol(symbol); |
| 70056 | } |
| 70057 | if (symbol.flags & (3 /* SymbolFlags.Variable */ | 4 /* SymbolFlags.Property */)) { |
| 70058 | if (ts.getCheckFlags(symbol) & 262144 /* CheckFlags.Mapped */) { |
| 70059 | var origin = symbol.syntheticOrigin; |
| 70060 | if (origin && getExplicitTypeOfSymbol(origin)) { |
| 70061 | return getTypeOfSymbol(symbol); |
| 70062 | } |
| 70063 | } |
| 70064 | var declaration = symbol.valueDeclaration; |
| 70065 | if (declaration) { |
| 70066 | if (isDeclarationWithExplicitTypeAnnotation(declaration)) { |
| 70067 | return getTypeOfSymbol(symbol); |
| 70068 | } |
| 70069 | if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { |
| 70070 | var statement = declaration.parent.parent; |
| 70071 | var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); |
| 70072 | if (expressionType) { |
| 70073 | var use = statement.awaitModifier ? 15 /* IterationUse.ForAwaitOf */ : 13 /* IterationUse.ForOf */; |
| 70074 | return checkIteratedTypeOrElementType(use, expressionType, undefinedType, /*errorNode*/ undefined); |
| 70075 | } |
| 70076 | } |
| 70077 | if (diagnostic) { |
| 70078 | ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(declaration, ts.Diagnostics._0_needs_an_explicit_type_annotation, symbolToString(symbol))); |
| 70079 | } |
| 70080 | } |
| 70081 | } |
| 70082 | } |
| 70083 | // We require the dotted function name in an assertion expression to be comprised of identifiers |
| 70084 | // that reference function, method, class or value module symbols; or variable, property or |
| 70085 | // parameter symbols with declarations that have explicit type annotations. Such references are |
no test coverage detected
searching dependent graphs…