Skip to content

Commit 81db533

Browse files
committed
Fix angular compiler error on trustedTypes
1 parent 3007a37 commit 81db533

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

client/app/src/pages/app/app.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export class AppComponent implements AfterViewInit, OnInit, OnDestroy{
104104
elem = document.createElement("script");
105105
elem.type = "module";
106106
let scriptURL = "/s/script";
107-
if (window.trustedTypes?.defaultPolicy) {
108-
const safeURL = window.trustedTypes.defaultPolicy.createScriptURL(scriptURL);
107+
if ((window as any).trustedTypes?.defaultPolicy) {
108+
const safeURL = (window as any).trustedTypes.defaultPolicy.createScriptURL(scriptURL);
109109
if (typeof safeURL === "string") {
110110
scriptURL = safeURL;
111111
}

client/app/src/services/helper/trusted-types.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import DOMPurify from 'dompurify';
77
})
88
export class TrustedTypesService {
99
constructor() {
10-
if (window.trustedTypes) {
11-
window.trustedTypes.createPolicy('default', {
10+
if ((window as any).trustedTypes) {
11+
(window as any).trustedTypes.createPolicy('default', {
1212
createHTML: (input: string) => {
1313
// Sanitize the input using DOMPurify or any other sanitizer library
1414
return (DOMPurify.sanitize(input, { RETURN_TRUSTED_TYPE: true }) as unknown) as string;

0 commit comments

Comments
 (0)