fix: replace more any types in components

- fix edra placeholder components with proper editor context types
- fix gallery image types with proper type assertions
- fix ProseMirror transaction types in link manager
- fix command types in composer toolbar
- replace any with unknown where type is dynamic
This commit is contained in:
Justin Edmund 2025-11-23 05:37:28 -08:00
parent 9c746d51c0
commit 3d77922a99
11 changed files with 23 additions and 23 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts">
interface Props {
title: string
actions?: any
actions?: unknown
}
let { title, actions }: Props = $props()

View file

@ -133,10 +133,10 @@
}
// Dismiss dropdowns on typing
export function dismissOnTyping(transaction: any) {
export function dismissOnTyping(transaction: unknown) {
if (showUrlConvertDropdown && transaction.docChanged) {
const hasTextChange = transaction.steps.some(
(step: any) =>
(step: unknown) =>
step.toJSON().stepType === 'replace' || step.toJSON().stepType === 'replaceAround'
)
if (hasTextChange) {

View file

@ -7,8 +7,8 @@
editor: Editor
variant: ComposerVariant
currentTextStyle: string
filteredCommands: any
colorCommands: any[]
filteredCommands: unknown
colorCommands: unknown[]
excludedCommands: string[]
showMediaLibrary: boolean
onTextStyleDropdownToggle: () => void

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -38,8 +38,8 @@
updateAttributes({ images: newImages })
} else {
// Add to existing images
const existingImages = node.attrs.images || []
const currentIds = existingImages.map((img: any) => img.id)
const existingImages = (node.attrs.images || []) as Array<{ id: number; [key: string]: unknown }>
const currentIds = existingImages.map((img) => img.id)
const uniqueNewImages = newImages.filter((img) => !currentIds.includes(img.id))
updateAttributes({ images: [...existingImages, ...uniqueNewImages] })
}
@ -54,8 +54,8 @@
}
function removeImage(imageId: number) {
const currentImages = node.attrs.images || []
const updatedImages = currentImages.filter((img: any) => img.id !== imageId)
const currentImages = (node.attrs.images || []) as Array<{ id: number; [key: string]: unknown }>
const updatedImages = currentImages.filter((img) => img.id !== imageId)
updateAttributes({ images: updatedImages })
}

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()

View file

@ -9,7 +9,7 @@
const { editor, deleteNode, getPos }: NodeViewProps = $props()
// Get album context if available
const editorContext = getContext<any>('editorContext') || {}
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
const albumId = $derived(editorContext.albumId)
// Generate unique pane ID based on node position
@ -41,7 +41,7 @@
function handleKeyDown(e: KeyboardEvent) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
handleClick(e as any)
handleClick(e as unknown as MouseEvent)
} else if (e.key === 'Escape') {
if (showPane) {
paneManager.close()