Skip to content

Commit 79ecf5f

Browse files
Fix CI/Formatting issues
1 parent 7eb96f6 commit 79ecf5f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/services/completions.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,35 +1862,33 @@ function createCompletionEntry(
18621862
) {
18631863
// Check if we should use quotes for string-like types
18641864
let shouldUseQuotes = false;
1865-
1865+
18661866
if (type.flags & TypeFlags.StringLike) {
18671867
// Direct string-like type
18681868
shouldUseQuotes = true;
1869-
} else if (type.flags & TypeFlags.Union) {
1869+
}
1870+
else if (type.flags & TypeFlags.Union) {
18701871
const unionType = type as UnionType;
18711872
// Check if all types are string-like or undefined (original logic)
1872-
const allTypesAreStringLikeOrUndefined = every(unionType.types, type =>
1873-
!!(type.flags & (TypeFlags.StringLike | TypeFlags.Undefined) || isStringAndEmptyAnonymousObjectIntersection(type))
1874-
);
1875-
1873+
const allTypesAreStringLikeOrUndefined = every(unionType.types, type => !!(type.flags & (TypeFlags.StringLike | TypeFlags.Undefined) || isStringAndEmptyAnonymousObjectIntersection(type)));
1874+
18761875
if (allTypesAreStringLikeOrUndefined) {
18771876
shouldUseQuotes = true;
1878-
} else {
1877+
}
1878+
else {
18791879
// Check if the union contains string-like types that users would typically provide as strings
18801880
// This handles cases like Preact's Signalish<string | undefined> = string | undefined | SignalLike<string | undefined>
18811881
const hasStringLikeTypes = some(unionType.types, type => !!(type.flags & TypeFlags.StringLike));
1882-
const hasNonObjectTypes = some(unionType.types, type =>
1883-
!!(type.flags & (TypeFlags.StringLike | TypeFlags.Undefined | TypeFlags.Null))
1884-
);
1885-
1882+
const hasNonObjectTypes = some(unionType.types, type => !!(type.flags & (TypeFlags.StringLike | TypeFlags.Undefined | TypeFlags.Null)));
1883+
18861884
// If the union has string-like types and at least some primitive types (not just objects),
18871885
// prefer quotes since users commonly want to provide string values
18881886
if (hasStringLikeTypes && hasNonObjectTypes) {
18891887
shouldUseQuotes = true;
18901888
}
18911889
}
18921890
}
1893-
1891+
18941892
if (shouldUseQuotes) {
18951893
// If is string like or undefined use quotes
18961894
insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;

0 commit comments

Comments
 (0)