Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/hooks/useScript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ export default function useScript({
scriptEl.src = src;

Object.keys(attributes).forEach((key) => {
// @ts-ignore
if (scriptEl[key] === undefined) {
if (!(key in scriptEl)) {
scriptEl.setAttribute(key, attributes[key]);
} else {
// @ts-ignore
scriptEl[key] = attributes[key];
(scriptEl as any)[key] = attributes[key];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an explicit type assertion is better than @ts-ignore, but consider using a more specific type like (scriptEl as Record<string, any>)[key] instead of any to maintain some type safety while still allowing dynamic property access.

}
});

Expand Down