Skip to content

Commit 1749ce3

Browse files
committed
fix(trusted-types): Use 'trusted-types/lib'
1 parent e9035b1 commit 1749ce3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

dist/purify.cjs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference types="trusted-types" />
1+
/// <reference types="trusted-types/lib" />
22
/*! @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 */
33

44
/**

dist/purify.es.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference types="trusted-types" />
1+
/// <reference types="trusted-types/lib" />
22
/*! @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 */
33

44
/**

scripts/fix-types.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ function addTrustedTypesReference(types) {
5353
// We need to tell TypeScript that we use the type declarations from
5454
// `trusted-types` so that it ends up in our type declaration type).
5555
// Without this, the references to trusted-types in the type declaration
56-
// file can cause compilation errors for certain configurations.
57-
return `/// <reference types="trusted-types" />\n${types}`;
56+
// file can cause compilation errors for certain configurations. We use
57+
// the '/lib' entrypoint to avoid modifying global scope, see:
58+
// https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trusted-types#library-usage
59+
return `/// <reference types="trusted-types/lib" />\n${types}`;
5860
}

0 commit comments

Comments
 (0)