fix(trusted-types): Use 'trusted-types/lib'

This commit is contained in:
Don McCurdy
2025-03-17 15:34:07 -04:00
parent d5e80f9fe5
commit cefab9f664
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference types="trusted-types" />
/// <reference types="trusted-types/lib" />
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
/**
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference types="trusted-types" />
/// <reference types="trusted-types/lib" />
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
/**
+4 -2
View File
@@ -53,6 +53,8 @@ function addTrustedTypesReference(types) {
// We need to tell TypeScript that we use the type declarations from
// `trusted-types` so that it ends up in our type declaration type).
// Without this, the references to trusted-types in the type declaration
// file can cause compilation errors for certain configurations.
return `/// <reference types="trusted-types" />\n${types}`;
// file can cause compilation errors for certain configurations. We use
// the '/lib' entrypoint to avoid modifying global scope, see:
// https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trusted-types#library-usage
return `/// <reference types="trusted-types/lib" />\n${types}`;
}