Skip to content

Commit 0a12f3e

Browse files
committed
add fourslash test and fix the reduction issue
1 parent 3458d37 commit 0a12f3e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16439,7 +16439,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1643916439
}
1644016440

1644116441
function removeStringLiteralsMatchedByTemplateLiterals(types: Type[]) {
16442-
const templates = filter(types, t => !!(t.flags & TypeFlags.TemplateLiteral) && isPatternLiteralType(t)) as TemplateLiteralType[];
16442+
const templates = filter(types, t =>
16443+
!!(t.flags & TypeFlags.TemplateLiteral) &&
16444+
isPatternLiteralType(t) &&
16445+
(t as TemplateLiteralType).types.every(t => !(t.flags & TypeFlags.Intersection) || !areIntersectedTypesAvoidingPrimitiveReduction((t as IntersectionType).types))
16446+
) as TemplateLiteralType[];
1644316447
if (templates.length) {
1644416448
let i = types.length;
1644516449
while (i > 0) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// function conversionTest(groupName: | "downcast" | "dataDowncast" | "editingDowncast" | `${string & {}}Downcast`) {}
4+
//// conversionTest("/**/");
5+
6+
verify.completions({ marker: "", exact: ["downcast", "dataDowncast", "editingDowncast"] });

0 commit comments

Comments
 (0)