Skip to content

Commit bcf39e1

Browse files
Copilothotlong
andcommitted
fix: resolve TypeScript build errors in ViewTabBar.tsx
- Fix DraggableAttributes cast by using double assertion (as unknown as Record<string, unknown>) - Remove redundant visibility !== 'private' check (already handled by prior if-branch) - Add explicit event handler types for Input onChange/onKeyDown/onClick Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 64c532b commit bcf39e1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/plugin-view/src/ViewTabBar.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const SortableTab: React.FC<{
185185
opacity: isDragging ? 0.5 : undefined,
186186
};
187187

188-
return <>{children({ setNodeRef, style, listeners, attributes: attributes as Record<string, unknown>, isDragging })}</>;
188+
return <>{children({ setNodeRef, style, listeners, attributes: attributes as unknown as Record<string, unknown>, isDragging })}</>;
189189
};
190190

191191
/**
@@ -322,7 +322,7 @@ export const ViewTabBar: React.FC<ViewTabBarProps> = ({
322322
if (view.visibility === 'private') {
323323
return <Lock data-testid={`view-tab-visibility-${view.id}`} className="h-3 w-3 text-muted-foreground shrink-0" />;
324324
}
325-
if (view.visibility && view.visibility !== 'private') {
325+
if (view.visibility) {
326326
return <Globe data-testid={`view-tab-visibility-${view.id}`} className="h-3 w-3 text-muted-foreground shrink-0" />;
327327
}
328328
return null;
@@ -365,14 +365,14 @@ export const ViewTabBar: React.FC<ViewTabBarProps> = ({
365365
ref={renameInputRef}
366366
data-testid={`view-tab-rename-input-${view.id}`}
367367
value={renameValue}
368-
onChange={(e) => setRenameValue(e.target.value)}
368+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setRenameValue(e.target.value)}
369369
onBlur={commitRename}
370-
onKeyDown={(e) => {
370+
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
371371
if (e.key === 'Enter') commitRename();
372372
if (e.key === 'Escape') cancelRename();
373373
}}
374374
className="h-5 w-24 px-1 py-0 text-sm border-none focus-visible:ring-1"
375-
onClick={(e) => e.stopPropagation()}
375+
onClick={(e: React.MouseEvent<HTMLInputElement>) => e.stopPropagation()}
376376
/>
377377
) : (
378378
<span>{view.label}</span>

0 commit comments

Comments
 (0)