diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts
index 5e7dede93ee..a62be540854 100644
--- a/src/harness/fourslash.ts
+++ b/src/harness/fourslash.ts
@@ -899,7 +899,7 @@ namespace FourSlash {
}
else {
const found = actualByName.get(exclude.name);
- if (found.source === exclude.source) {
+ if (found && found.source === exclude.source) {
this.raiseError(`Did not expect to get a completion named ${exclude.name} with source ${exclude.source}`);
}
}
diff --git a/src/services/completions.ts b/src/services/completions.ts
index 4950d1370e1..27869ca572c 100644
--- a/src/services/completions.ts
+++ b/src/services/completions.ts
@@ -972,12 +972,8 @@ namespace ts.Completions {
}
else if (isRightOfOpenTag) {
const tagSymbols = Debug.assertEachDefined(typeChecker.getJsxIntrinsicTagNamesAt(location), "getJsxIntrinsicTagNames() should all be defined");
- if (tryGetGlobalSymbols()) {
- symbols = tagSymbols.concat(symbols.filter(s => !!(s.flags & (SymbolFlags.Value | SymbolFlags.Alias))));
- }
- else {
- symbols = tagSymbols;
- }
+ tryGetGlobalSymbols();
+ symbols = tagSymbols.concat(symbols);
completionKind = CompletionKind.MemberLike;
}
else if (isStartingCloseTag) {
@@ -1298,7 +1294,7 @@ namespace ts.Completions {
const exportedSymbols = typeChecker.getExportsOfModule(symbol);
// If the exported symbols contains type,
// symbol can be referenced at locations where type is allowed
- return forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation);
+ return exportedSymbols.some(symbolCanBeReferencedAtTypeLocation);
}
}
diff --git a/tests/cases/fourslash/completionsImport_tsx.ts b/tests/cases/fourslash/completionsImport_tsx.ts
new file mode 100644
index 00000000000..ff9d79a3e3b
--- /dev/null
+++ b/tests/cases/fourslash/completionsImport_tsx.ts
@@ -0,0 +1,21 @@
+///
+
+// @noLib: true
+// @nolib: true
+// @jsx: preserve
+
+// @Filename: /a.tsx
+////export type Bar = 0;
+////export default function Foo() {};
+
+// @Filename: /b.tsx
+////;
+
+verify.completions({
+ marker: "",
+ includes: { name: "Foo", source: "/a.tsx", hasAction: true },
+ excludes: "Bar",
+ preferences: {
+ includeCompletionsForModuleExports: true,
+ },
+});