Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Motivation Resolve security warning [#39 ](https://github.com/dfinity/gix-components/security/dependabot/39) # Changes - Bump dompurify to v3.2.4 - Use renamed function `beforeSanitizeAttributes` - Remove dompurify types - Adapt test by casting and remove optional argument for contructor to resolve below issues # Issues to adapt for tests ``` src/lib/utils/html.utils.ts:54:32 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. 54 } else if (typeof global.DOMPurify.sanitize === "function") { ~~~~~~~~~ src/lib/utils/html.utils.ts:56:28 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature. 56 domPurify = global.DOMPurify; ~~~~~~~~~ src/lib/utils/html.utils.ts:60:26 - error TS2769: No overload matches this call. The last overload gave the following error. Argument of type '"beforeSanitizeElements"' is not assignable to parameter of type 'DocumentFragmentHookName'. 60 domPurify?.addHook("beforeSanitizeElements", flagTargetAttributeHook); ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/dompurify/dist/purify.es.d.mts:315:5 315 addHook(entryPoint: DocumentFragmentHookName, hookFunction: DocumentFragmentHook): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The last overload is declared here. vitest.setup.ts:23:26 - error TS2345: Argument of type 'Window' is not assignable to parameter of type 'WindowLike'. Type 'Window' is missing the following properties from type 'Pick<typeof globalThis, "NodeFilter" | "DOMParser" | "DocumentFragment" | "Element" | "HTMLFormElement" | "HTMLTemplateElement" | "NamedNodeMap" | "Node">': NodeFilter, DOMParser, DocumentFragment, Element, and 4 more. 23 const purify = DOMPurify(window as unknown as Window); ```
- Loading branch information