diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4046d4a7c36..af3249ddca2 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3280,10 +3280,11 @@ namespace ts { case SyntaxKind.VoidKeyword: return false case SyntaxKind.LessThanToken: - // TODO (yuisu): comment + // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression if (sourceFile.languageVariant !== LanguageVariant.JSX) { return false; } + // We are in JSX context and the token is part of JSXElement. // Fall through default: return true; @@ -3310,7 +3311,7 @@ namespace ts { return finishNode(node); } else if (sourceFile.languageVariant === LanguageVariant.JSX && token === SyntaxKind.LessThanToken && lookAhead(nextTokenIsIdentifierOrKeyword)) { - // TODO (yuisu) : comment + // JSXElement is part of primaryExpression return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3da3c354fb2..3043f6be708 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -862,8 +862,8 @@ namespace ts { const importedFile = findModuleSourceFile(resolution.resolvedFileName, file.imports[i]); if (importedFile && resolution.isExternalLibraryImport) { if (!isExternalModule(importedFile)) { - let start = getTokenPosOfNode(file.imports[i], file) - fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); + let start = getTokenPosOfNode(file.imports[i], file) + fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName)); } else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) { let start = getTokenPosOfNode(file.imports[i], file)