Skip to content

Commit

Permalink
Fix type error and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud committed Oct 31, 2022
1 parent d76e6f4 commit fae15dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/utils/misc/isElementType.ts
Expand Up @@ -2,7 +2,7 @@ type tag = keyof HTMLElementTagNameMap

export function isElementType<
T extends tag,
P extends {[k: string]: unknown} | undefined = undefined
P extends {[k: string]: unknown} | undefined = undefined,
>(
element: Element,
tag: T | T[],
Expand All @@ -25,7 +25,7 @@ export function isElementType<
}

if (props) {
return Object.entries(props as NonNullable<P>).every(
return Object.entries(props).every(
([k, v]) => element[k as keyof Element] === v,
)
}
Expand Down
4 changes: 2 additions & 2 deletions tests/_helpers/listeners.ts
Expand Up @@ -149,10 +149,10 @@ export function addListeners(
}
}

function hasProperty<T extends {}, K extends PropertyKey>(
function hasProperty<T extends {}, K extends PropertyKey, V = string>(
obj: T,
prop: K,
): obj is T & {[k in K]: unknown} {
): obj is T & {[k in K]: V} {
return prop in obj
}

Expand Down

0 comments on commit fae15dd

Please sign in to comment.